public final class ExceptionUtil extends Object
Modifier and Type | Method and Description |
---|---|
static void |
fixRemoteStackTrace(Throwable remoteCause,
StackTraceElement[] localSideStackTrace)
This method changes the given remote cause, and it adds the also given local stacktrace.
If the remoteCause is an ExecutionException and it has a non-null inner
cause, this inner cause is unwrapped and the local stacktrace and exception message are added to the
that instead of the given remoteCause itself. |
static void |
fixRemoteStackTrace(Throwable remoteCause,
StackTraceElement[] localSideStackTrace,
String localExceptionMessage)
This method changes the given remote cause, and it adds the also given local stacktrace separated by the
supplied exception message.
If the remoteCause is an ExecutionException and it has a non-null inner
cause, this inner cause is unwrapped and the local stacktrace and exception message are added to the
that instead of the given remoteCause itself. |
static RuntimeException |
peel(Throwable t) |
static <T extends Throwable> |
peel(Throwable t,
Class<T> allowedType) |
static RuntimeException |
rethrow(Throwable t) |
static <T extends Throwable> |
rethrow(Throwable t,
Class<T> allowedType) |
static <T extends Throwable> |
rethrowAllowedTypeFirst(Throwable t,
Class<T> allowedType)
This rethrow the exception providing an allowed Exception in first priority, even it is a Runtime exception
|
static RuntimeException |
rethrowAllowInterrupted(Throwable t) |
static <T> T |
sneakyThrow(Throwable t) |
static String |
toString(Throwable cause)
Converts a Throwable stacktrace to a String.
|
public static String toString(Throwable cause)
cause
- the Throwablepublic static RuntimeException peel(Throwable t)
public static RuntimeException rethrow(Throwable t)
public static <T extends Throwable> RuntimeException rethrow(Throwable t, Class<T> allowedType) throws T extends Throwable
T extends Throwable
public static <T extends Throwable> RuntimeException rethrowAllowedTypeFirst(Throwable t, Class<T> allowedType) throws T extends Throwable
T extends Throwable
public static RuntimeException rethrowAllowInterrupted(Throwable t) throws InterruptedException
InterruptedException
public static <T> T sneakyThrow(Throwable t)
public static void fixRemoteStackTrace(Throwable remoteCause, StackTraceElement[] localSideStackTrace)
ExecutionException
and it has a non-null inner
cause, this inner cause is unwrapped and the local stacktrace and exception message are added to the
that instead of the given remoteCause itself.remoteCause
- the remotely generated exceptionlocalSideStackTrace
- the local stacktrace to add to the exception stacktracepublic static void fixRemoteStackTrace(Throwable remoteCause, StackTraceElement[] localSideStackTrace, String localExceptionMessage)
ExecutionException
and it has a non-null inner
cause, this inner cause is unwrapped and the local stacktrace and exception message are added to the
that instead of the given remoteCause itself.remoteCause
- the remotely generated exceptionlocalSideStackTrace
- the local stacktrace to add to the exceptions stacktracelocalExceptionMessage
- a special exception message which is added to the stacktraceCopyright © 2016 Hazelcast, Inc.. All Rights Reserved.