public class NestedRuntimeException
extends java.lang.RuntimeException
RuntimeException
which is nested to preserve stack traces.
This class allows the following code to be written to convert a regular
Exception into a RuntimeException
without losing the stack trace.
try { ... } catch (Exception e) { throw new RuntimeException(e); }
Constructor and Description |
---|
NestedRuntimeException(java.lang.String msg,
java.lang.Throwable cause)
Constructs a new
NestedRuntimeException with specified
detail message and nested Throwable . |
NestedRuntimeException(java.lang.Throwable cause)
Constructs a new
NestedRuntimeException with specified
nested Throwable . |
Modifier and Type | Method and Description |
---|---|
java.lang.Throwable |
getCause() |
void |
printStackTrace() |
void |
printStackTrace(java.io.PrintStream out) |
void |
printStackTrace(java.io.PrintWriter out) |
public NestedRuntimeException(java.lang.Throwable cause)
NestedRuntimeException
with specified
nested Throwable
.cause
- the exception or error that caused this exception to be
thrownpublic NestedRuntimeException(java.lang.String msg, java.lang.Throwable cause)
NestedRuntimeException
with specified
detail message and nested Throwable
.msg
- the error messagecause
- the exception or error that caused this exception to be
thrownpublic java.lang.Throwable getCause()
getCause
in class java.lang.Throwable
public void printStackTrace()
printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintStream out)
printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintWriter out)
printStackTrace
in class java.lang.Throwable
Copyright © 2012. All Rights Reserved.