public final class ExceptionUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CLASSNAME_KEY
Classname of the exception
|
static String |
EXCEPTION_KEY
java.lang.Throwable: value is present iff the class is in packages found in
OVER_THE_WIRE_PACKAGE_PREFIXES |
static String |
MESSAGE_KEY
String from t.getMessage()
|
static Set<String> |
OVER_THE_WIRE_PACKAGE_PREFIXES
Package prefixes acceptable for passing back a Throwable object so as to avoid
a ClassNotFoundException on a client.
|
static String |
STACK_TRACE_KEY
StackTraceElement[]
|
static String |
STACK_TRACE_STRING_KEY
String version of the stack trace
|
Modifier and Type | Method and Description |
---|---|
static Throwable[] |
getCauses(Throwable start)
Get the chain of exceptions via getCause().
|
static Throwable |
getRootCause(Throwable e)
Get the original troublemaker.
|
static String |
getStackTrace() |
static String |
getStackTrace(Throwable t)
Get the stack trace as a String.
|
static boolean |
isAcceptableOverTheWire(Throwable t) |
static Map<String,Object> |
toMap(Throwable t)
Return a Map with constituent parts including:
MESSAGE_KEY
STACK_TRACE_KEY
STACK_TRACE_STRING_KEY
EXCEPTION_KEY
Caller should generally use Exceptionutil.toMap( ExceptionUtil.getRootCause(t) ) |
static String |
toString(Throwable t) |
public static final String MESSAGE_KEY
public static final String CLASSNAME_KEY
public static final String STACK_TRACE_KEY
public static final String STACK_TRACE_STRING_KEY
public static final String EXCEPTION_KEY
OVER_THE_WIRE_PACKAGE_PREFIXES
public static String getStackTrace()
public static boolean isAcceptableOverTheWire(Throwable t)
public static Map<String,Object> toMap(Throwable t)
public static Throwable[] getCauses(Throwable start)
start
- the Exception to traversepublic static Throwable getRootCause(Throwable e)
e
- the Exception to dig intoCopyright © 2018. All rights reserved.