public abstract class NestedException
extends java.lang.Exception
This exception can optionally wrap another exception. The printed stack
trace will be that of the wrapped exception, if one is provided in the
constructor. The underlying exception can be obtained from
getException
.
Several exceptions support wrapping of an underlying exception by extending from this class. When another nested exception is provided in the constructor, the underlying exception will be used, so it's safe to construct a nested exception from another nested exception.
Support for unwrapping the underlying exceptions include
NestedException
, SAXException
.
Constructor and Description |
---|
NestedException(java.lang.Exception except)
Construct a new nested exception wrapping an underlying exception.
|
NestedException(java.lang.String message)
Construct a new nested with a message.
|
NestedException(java.lang.String message,
java.lang.Exception except)
Construct a new nested exception wrapping an underlying exception
and providing a message.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Exception |
getException()
Returns the underlying exception, if this exception wraps another exception.
|
void |
printStackTrace()
Overrides Exception.printStackTrace to print the nested exception's
stack trace, if there is one.
|
void |
printStackTrace(java.io.PrintStream stream)
Overrides Exception.printStackTrace to print the nested exception's
stack trace, if there is one.
|
void |
printStackTrace(java.io.PrintWriter writer)
Overrides Exception.printStackTrace to print the nested exception's
stack trace, if there is one.
|
public NestedException(java.lang.String message, java.lang.Exception except)
message
- The exception messageexcept
- The underlying exceptionpublic NestedException(java.lang.String message)
message
- The exception messagepublic NestedException(java.lang.Exception except)
except
- The underlying exceptionpublic java.lang.Exception getException()
public void printStackTrace()
printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintStream stream)
printStackTrace
in class java.lang.Throwable
stream
- The stream to write the stack trace to.public void printStackTrace(java.io.PrintWriter writer)
printStackTrace
in class java.lang.Throwable
writer
- The writer to write the stack trace to.Copyright ? 2002 Clarity Systems Group, LLC. All Rights Reserved.