|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--org.openorb.util.ExceptionTool
A utility class for optionaly attaching causal objects to exceptions
if the exception implementation supports initCause.
Note that these utilities only are safe to use in JDK 1.3 bu only have
an effect under JDK 1.4+.
| Method Summary | |
static Throwable |
appendCause(Throwable e,
Throwable cause)
Attaches a Throwable to the end of the causal chain,
if possible. |
static Throwable |
appendPossibleCause(Throwable e,
Throwable cause)
Attaches a Throwable to the end of the causal chain as
a possible cause, if possible. |
static Throwable |
getCause(Throwable e)
Returns the cause associated with the Throwable if
available. |
static Error |
initCause(Error e,
Throwable cause)
Attaches the cause to the exception if this operation is supported by the current environment. |
static RuntimeException |
initCause(RuntimeException e,
Throwable cause)
Attaches the cause to the exception if this operation is supported by the current environment. |
static SystemException |
initCause(SystemException e,
Throwable cause)
Attaches the cause to the exception if this operation is supported by the current environment. |
static Throwable |
initCause(Throwable e,
Throwable cause)
Attaches the cause to the exception if this operation is supported by the current environment. |
static UserException |
initCause(UserException e,
Throwable cause)
Attaches the cause to the exception if this operation is supported by the current environment. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static Throwable getCause(Throwable e)
Throwable if
available.e - the Throwable to get the cause fromnull if not
public static SystemException initCause(SystemException e,
Throwable cause)
e - the exception to attach the cause tocause - the cause of this specified exception
public static UserException initCause(UserException e,
Throwable cause)
e - the exception to attach the cause tocause - the cause of this specified exception
public static Throwable initCause(Throwable e,
Throwable cause)
e - the exception to attach the cause tocause - the cause of this specified exception
public static RuntimeException initCause(RuntimeException e,
Throwable cause)
e - the exception to attach the cause tocause - the cause of this specified exception
public static Error initCause(Error e,
Throwable cause)
e - the exception to attach the cause tocause - the cause of this specified exception
public static Throwable appendCause(Throwable e,
Throwable cause)
Throwable to the end of the causal chain,
if possible. If the cause of the last Throwable is
explicity set to null then attachment is not possible.e - the recipient of the attachmentcause - the attachmentNullPointerException - if e is nullIllegalArgumentException - if e == cause
public static Throwable appendPossibleCause(Throwable e,
Throwable cause)
Throwable to the end of the causal chain as
a possible cause, if possible. If the cause of the last
Throwable is explicity set to null then attachment is
not possible. This utility would be used to retain the possible root
cause of a problem that can be masked by an exception thrown in the
finally block. For Example:
final Throwable cause = null;
try {
someMethod();
} catch (final Exception e) {
possibleCause = e;
throw e;
} finally {
try {
cleanUp();
} catch (final Exception e2) {
ExceptionTool.appendPossibleCause(e2, e);
throw e2;
}
}
e - the recipient of the attachmentcause - the attachmentNullPointerException - if e is nullIllegalArgumentException - if e == cause
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||