Package org.glassfish.admin.amx.util
Class ExceptionUtil
- java.lang.Object
-
- org.glassfish.admin.amx.util.ExceptionUtil
-
public final class ExceptionUtil extends Object
Useful utilities for Exceptions
-
-
Field Summary
Fields Modifier and Type Field Description static String
CLASSNAME_KEY
Classname of the exceptionstatic String
EXCEPTION_KEY
java.lang.Throwable: value is present iff the class is in packages found inOVER_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
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Field Detail
-
MESSAGE_KEY
public static final String MESSAGE_KEY
String from t.getMessage()- See Also:
- Constant Field Values
-
CLASSNAME_KEY
public static final String CLASSNAME_KEY
Classname of the exception- See Also:
- Constant Field Values
-
STACK_TRACE_KEY
public static final String STACK_TRACE_KEY
StackTraceElement[]- See Also:
- Constant Field Values
-
STACK_TRACE_STRING_KEY
public static final String STACK_TRACE_STRING_KEY
String version of the stack trace- See Also:
- Constant Field Values
-
EXCEPTION_KEY
public static final String EXCEPTION_KEY
java.lang.Throwable: value is present iff the class is in packages found inOVER_THE_WIRE_PACKAGE_PREFIXES
- See Also:
- Constant Field Values
-
-
Method Detail
-
getStackTrace
public static String getStackTrace()
-
isAcceptableOverTheWire
public static boolean isAcceptableOverTheWire(Throwable t)
-
toMap
public static Map<String,Object> toMap(Throwable t)
Return a Map with constituent parts including: Caller should generally use Exceptionutil.toMap( ExceptionUtil.getRootCause(t) )
-
getCauses
public static Throwable[] getCauses(Throwable start)
Get the chain of exceptions via getCause(). The first element is the Exception passed.- Parameters:
start
- the Exception to traverse- Returns:
- a Throwable[] or an Exception[] as appropriate
-
getRootCause
public static Throwable getRootCause(Throwable e)
Get the original troublemaker.- Parameters:
e
- the Exception to dig into- Returns:
- the original Throwable that started the problem
-
-