public final class ExceptionUtils
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
ExceptionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends java.lang.Throwable> |
accumulateException(T current,
T extra)
Used to "accumulate" exceptions of the same type.
|
static java.lang.Throwable |
peelException(java.lang.Throwable t)
Attempts to get to the "effective" exception being thrown, by taking care of some known exceptions that
wrap the original thrown one.
|
static java.lang.Throwable |
resolveExceptionCause(java.lang.Throwable t) |
static void |
rethrowAsIoException(java.lang.Throwable e) |
static java.lang.RuntimeException |
toRuntimeException(java.lang.Throwable t) |
static java.lang.RuntimeException |
toRuntimeException(java.lang.Throwable t,
boolean peelThrowable)
Converts a thrown generic exception to a
RuntimeException |
public static void rethrowAsIoException(java.lang.Throwable e)
throws java.io.IOException
java.io.IOExceptionpublic static <T extends java.lang.Throwable> T accumulateException(T current,
T extra)
null then
the new one becomes the current, otherwise the new one is added as a suppressed exception to the current
oneT - The exception typecurrent - The current exceptionextra - The extra/new exceptionThrowable.addSuppressed(Throwable)public static java.lang.Throwable resolveExceptionCause(java.lang.Throwable t)
t - The original Throwable - ignored if nullThrowable.getCause() is non-null then the cause, otherwise the original exception -
null if the original exception was nullpublic static java.lang.Throwable peelException(java.lang.Throwable t)
t - The original Throwable - ignored if nullpublic static java.lang.RuntimeException toRuntimeException(java.lang.Throwable t,
boolean peelThrowable)
RuntimeExceptiont - The original thrown exceptionpeelThrowable - Whether to determine the root cause by "peeling" any enclosing exceptionspeelException(Throwable)public static java.lang.RuntimeException toRuntimeException(java.lang.Throwable t)