public class CheckedExceptionTunnel
extends java.lang.RuntimeException
Modifier | Constructor and Description |
---|---|
protected |
CheckedExceptionTunnel() |
|
CheckedExceptionTunnel(java.lang.Exception checkedExceptionOrNull)
Returns an unchecked exception from a checkedException.
|
protected |
CheckedExceptionTunnel(java.lang.String msg) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getMessage() |
void |
printFullStackTrace()
Like
Throwable.printStackTrace() , but includes the tunnel's stacktrace as well. |
void |
printFullStackTrace(java.io.PrintStream s)
Like
printStackTrace(PrintStream) , but includes the tunnel's stacktrace as well. |
void |
printFullStackTrace(java.io.PrintWriter s)
Like
printStackTrace(PrintWriter) , but includes the tunnel's stacktrace as well. |
void |
printStackTrace(java.io.PrintStream s) |
void |
printStackTrace(java.io.PrintWriter s) |
java.lang.String |
toString() |
static java.lang.Exception |
unwrapIfNecessary(java.lang.Exception exception)
Returns the original exception before being wrapped, if the exception has been wrapped, or
exception otherwise.
|
static java.lang.Throwable |
unwrapIfNecessary(java.lang.Throwable throwable)
Returns the original throwable before being wrapped, if the throwable has been wrapped, or
exception otherwise.
|
static java.lang.RuntimeException |
wrapIfNecessary(java.lang.Exception exception)
Returns a
RuntimeException from an exception. |
static java.lang.RuntimeException |
wrapIfNecessary(java.lang.Throwable throwable)
Convenience wrapper for
wrapIfNecessary(Exception) . |
public CheckedExceptionTunnel(java.lang.Exception checkedExceptionOrNull)
checkedExceptionOrNull
- The checked exception to tunnel.protected CheckedExceptionTunnel(java.lang.String msg)
protected CheckedExceptionTunnel()
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
public java.lang.String toString()
toString
in class java.lang.Throwable
public void printStackTrace(java.io.PrintStream s)
printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintWriter s)
printStackTrace
in class java.lang.Throwable
public void printFullStackTrace()
Throwable.printStackTrace()
, but includes the tunnel's stacktrace as well.public void printFullStackTrace(java.io.PrintStream s)
printStackTrace(PrintStream)
, but includes the tunnel's stacktrace as well.public void printFullStackTrace(java.io.PrintWriter s)
printStackTrace(PrintWriter)
, but includes the tunnel's stacktrace as well.public static final java.lang.RuntimeException wrapIfNecessary(java.lang.Throwable throwable) throws java.lang.Error
wrapIfNecessary(Exception)
. If throwable is an
Error
, this method will not return but the error will be thrown.throwable
- The exception to represent by the return value.RuntimeException
representing the throwable.java.lang.Error
- If throwable is an Error
(except when it is a
ThreadDeath
, which returns a InterruptedExceptionUnchecked
).public static final java.lang.RuntimeException wrapIfNecessary(java.lang.Exception exception)
RuntimeException
from an exception. If exception is
already a RuntimeException
, itself is returned, otherwise an appropriate unchecked
equivalent. If no unchecked equivalent exists, a CheckedExceptionTunnel
is returned
with exception as checked exception argument.exception
- The exception to represent by the return value.RuntimeException
representing the exception.public static final java.lang.Exception unwrapIfNecessary(java.lang.Exception exception)
public static final java.lang.Throwable unwrapIfNecessary(java.lang.Throwable throwable)