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 StringCLASSNAME_KEYClassname of the exceptionstatic StringEXCEPTION_KEYjava.lang.Throwable: value is present iff the class is in packages found inOVER_THE_WIRE_PACKAGE_PREFIXESstatic StringMESSAGE_KEYString from t.getMessage()static Set<String>OVER_THE_WIRE_PACKAGE_PREFIXESPackage prefixes acceptable for passing back a Throwable object so as to avoid a ClassNotFoundException on a client.static StringSTACK_TRACE_KEYStackTraceElement[]static StringSTACK_TRACE_STRING_KEYString 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 ThrowablegetRootCause(Throwable e)Get the original troublemaker.static StringgetStackTrace()static StringgetStackTrace(Throwable t)Get the stack trace as a String.static booleanisAcceptableOverTheWire(Throwable t)static Map<String,Object>toMap(Throwable t)Return a Map with constituent parts including:MESSAGE_KEYSTACK_TRACE_KEYSTACK_TRACE_STRING_KEYEXCEPTION_KEYCaller should generally use Exceptionutil.toMap( ExceptionUtil.getRootCause(t) )static StringtoString(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
-
-