|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lc.util.Exceptions
Utility class for managing exceptions.
Method Summary | |
static java.lang.String |
getStackTraceAsString(java.lang.Throwable throwable)
Gets the stack trace into a String . |
static java.lang.Throwable[] |
peel(java.lang.Throwable throwable)
Peels nested Throwable s.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.String getStackTraceAsString(java.lang.Throwable throwable)
String
.throwable
- The one to get the stack trace from.public static java.lang.Throwable[] peel(java.lang.Throwable throwable)
Throwable
s.
Instances of Throwables may be nested through several exception
handlers, each one creating an exception around the one caught.
When the topmost throwables implement interface
CascadingThrowable
, it's possible to access
to the 1st Throwable which is the original cause, or does
not implement CascadingThrowable.
For the following code :
try { try { try { Throwable rte = new RuntimeException() ; throw rte ; } catch( Throwable th1 ) { throw new MyEncloser1( th1 ) // MyEncloser implements IThowableEncloser } } catch( Throwable th2 ) { throw new MyEncloser2( th2 ) // MyEncloser implements IThowableEncloser } } catch( Throwable th ) { Throwable[] throwables = Exceptions.peel( th ) ; }We'll get :
throwables[ 0 ] == rte throwables[ 1 ] == th1 throwables[ 2 ] == th2
throwable
- Potentially a CascadingThrowable
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |