| Modifier and Type | Method and Description |
|---|---|
static List<Throwable> |
getCauseChain(Throwable t)
Returns the chain of
Throwables that caused the given one. |
static Throwable |
getRootCause(Throwable t)
Returns the root cause of the given
Throwable. |
static List<String> |
getStackFrames(Throwable t)
Returns the stack frames of the given
Throwable. |
static String |
getStackTrace(Throwable t)
Returns the stack trace of the given
Throwable as a
String. |
static RuntimeException |
propagate(Throwable t)
Re-throws the given
Throwable if it is already an instance of
RuntimeException or Error, and, if not, wraps it in a
RuntimeException before throwing it. |
public static Throwable getRootCause(Throwable t)
Throwable. If the given
Throwable is not the result of a previous one, it is
considered as the root.t - the Throwable to get the root cause.Throwable.NullPointerException - if t is null.public static List<Throwable> getCauseChain(Throwable t)
Throwables that caused the given one.
The given Throwable is the first element in the returned
List, the last one is the root cause.t - the Throwable to get the chain.Throwable that caused t.NullPointerException - if t is null.public static String getStackTrace(Throwable t)
Throwable as a
String.t - the Throwable to get the stack trace.Throwable.NullPointerException - if t is null.public static List<String> getStackFrames(Throwable t)
Throwable. The stack
frames are simply obtained from calling toString on each
StackTraceElement of t.t - the Throwable to get the stack frames.Throwable.NullPointerException - if t is null.Throwable.getStackTrace()public static RuntimeException propagate(Throwable t)
Throwable if it is already an instance of
RuntimeException or Error, and, if not, wraps it in a
RuntimeException before throwing it.t - the Throwable to propagate.Throwable).NullPointerException - if t is null.RuntimeException - if t is already an instance of
RuntimeException or if t is neither an instance
of RuntimeException nor an instance of Error.Error - if t is an instance of Error.Copyright © 2012–2015. All rights reserved.