com.ibm.websphere.exception
Interface DistributedExceptionEnabled
- public interface DistributedExceptionEnabled
In addition to implementing the required methods, the implementing class should create an attribute, a DistributedExceptionInfo object, in each constructor, after it has done it's other work. This object will do most of the work for the methods. For all of the examples in the Javadoc of the methods, it is assumed that the name of this attribute is distributedExceptionInfo.
Typically, the implementor of this interface will have multiple constructors. See com.ibm.websphere.DistributedException for examples.
com.ibm.websphere.DistributedException
,
com.ibm.websphere.DistributedExceptionInfo
Method Summary
Modifier and Type | Method and Description |
---|---|
|
getException(java.lang.String exceptionClassName)
Get a specific exception in a possible chain of exceptions.
|
getExceptionInfo()
Retrieve the exception info for this exception.
|
|
|
getMessage()
Retrieve the message for this exception.
|
|
getOriginalException()
Get the original exception in a possible chain of exceptions.
|
|
getPreviousException()
Get the previous exception, in a possible chain of exceptions.
|
|
printStackTrace()
Print the stack trace for this exception and all chained
exceptions.
|
|
printStackTrace(java.io.PrintWriter pw)
Print the exception execution stack to a print writer.
|
|
printSuperStackTrace(java.io.PrintWriter pw)
This method is called by DistributedExceptionInfo to retrieve and
save the current stack trace.
|
Method Detail
getException
- java.lang.Throwable getException( java.lang.String exceptionClassName)
- throws ExceptionInstantiationException
ExceptionInstantiationException
- An exception occurred while trying to re-create the exception object.
If this exception is thrown, the relevant information can be retrieved
by using the getExceptionInfo() method followed by recursively using
the getPreviousExceptionInfo() method on the DistributedExceptionInfo
object. getExceptionInfo
- DistributedExceptionInfo getExceptionInfo( )
This could be coded as:
- return distributedExceptionInfo;
getMessage
- java.lang.String getMessage()
The following is an example of the code that should be used:
- if (distributedExceptionInfo != null)
- return distributedExceptionInfo.getMessage();
- else
- return null
Note: During the construction of the exception and the DistributedExceptionInfo object, there is one situation that results in a call to this method. Since distributedExceptionInfo is still null, a NullPointerException could occur if the check for null is excluded.
getOriginalException
- java.lang.Throwable getOriginalException( )
- throws ExceptionInstantiationException
If the DistributedExceptionInfo attribute is not null, the return value can be retrieved with the following code:
- distributedExceptionInfo.getOriginalException();
ExceptionInstantiationException
- An exception occurred while trying to re-create the exception object.
If this exception is thrown, the relevant information can be retrieved
by using the getExceptionInfo() method followed by recursively using
the getPreviousExceptionInfo() method on the DistributedExceptionInfo
object. getPreviousException
- java.lang.Throwable getPreviousException( )
- throws ExceptionInstantiationException
If the DistributedExceptionInfo attribute is not null, the return value can be retrieved with the following code:
- distributedExceptionInfo.getPreviousException();
ExceptionInstantiationException
- An exception occurred while trying to re-create the exception object.
If this exception is thrown, the relevant information can be retrieved
by using the getExceptionInfo() method. printStackTrace
- void printStackTrace()
If the DistributedExceptionInfo attribute is not null, the the following code will accomplish this:
- distributedExceptionInfo.printStackTrace();
printStackTrace
- void printStackTrace(java.io.PrintWriter pw)
If the DistributedExceptionInfo attribute is not null, the the following code will accomplish this:
- distributedExceptionInfo.printStackTrace(pw);
pw
- java.io.PrintWriter printSuperStackTrace
- void printSuperStackTrace(java.io.PrintWriter pw)
- super.printStackTrace(pw)
If the DistributedExceptionInfo attribute is not null, the return value can be retrieved with the following code: