Package com.ibm.websphere.exception
Interface DistributedExceptionEnabled
- All Known Implementing Classes:
DistributedException
,ExceptionInstantiationException
public interface DistributedExceptionEnabled
Copyright (c) 2004, 2014 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
IBM Corporation - initial API and implementation
-
Method Summary
Modifier and TypeMethodDescriptiongetException
(String exceptionClassName) Get a specific exception in a possible chain of exceptions.Retrieve the exception info for this exception.Retrieve the message for this exception.Get the original exception in a possible chain of exceptions.Get the previous exception, in a possible chain of exceptions.void
Print the stack trace for this exception and all chained exceptions.void
Print the exception execution stack to a print writer.void
This method is called by DistributedExceptionInfo to retrieve and save the current stack trace. super.printStackTrace(pw)
-
Method Details
-
getException
Get a specific exception in a possible chain of exceptions. If there are multiple exceptions in the chain, the most recent one thrown will be returned. If the exception does not exist or no exceptions have been chained, null will be returned.- If the DistributedExceptionInfo attribute is not null, the return value can be retrieved with the following code:
- distributedExceptionInfo.getException(exceptionClassName);
- Parameters:
String
- exceptionClassName: The class name of the specific exception.- Returns:
- java.lang.Throwable: The specific exception in a chain of exceptions.
- Throws:
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()Retrieve the exception info for this exception.- This could be coded as:
- return distributedExceptionInfo;
- Returns:
- com.ibm.websphere.exception.DistributedExceptionInfo
-
getMessage
String getMessage()Retrieve the message for this exception.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.
- Returns:
- java.lang.String
-
getOriginalException
Get the original exception in a possible chain of exceptions. If no previous exceptions have been chained, null will be returned.- If the DistributedExceptionInfo attribute is not null, the return value can be retrieved with the following code:
- distributedExceptionInfo.getOriginalException();
- Returns:
- java.lang.Throwable: The first exception in a chain of exceptions. If no exceptions have been chained, null will be returned.
- Throws:
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
Get the previous exception, in a possible chain of exceptions.- If the DistributedExceptionInfo attribute is not null, the return value can be retrieved with the following code:
- distributedExceptionInfo.getPreviousException();
- Returns:
- java.lang.Throwable: The previous exception. If there was no previous exception, null will be returned.
- Throws:
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()Print the stack trace for this exception and all chained exceptions. This will include the stack trace from the location where the exception was created, as well as the stack traces of previous exceptions in the exception chain.- If the DistributedExceptionInfo attribute is not null, the the following code will accomplish this:
- distributedExceptionInfo.printStackTrace();
-
printStackTrace
Print the exception execution stack to a print writer. This will include the stack trace from the location where the exception was created, as well as the stack traces of previous exceptions in the exception chain.- If the DistributedExceptionInfo attribute is not null, the the following code will accomplish this:
- distributedExceptionInfo.printStackTrace(pw);
- Parameters:
pw
- java.io.PrintWriter
-
printSuperStackTrace
- This method is called by DistributedExceptionInfo to retrieve and save the current stack trace.
- super.printStackTrace(pw)
- Parameters:
param
- java.io.PrintWriter
-