com.claritysys.util
Class NestedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.claritysys.util.NestedException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ServiceInitializationException

public abstract class NestedException
extends java.lang.Exception

Base type for all exceptions that can wrap another 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.

Version:
$Revision: 2348 $ $Date: 2004-12-01 16:12:21 -0800 (Wed, 01 Dec 2004) $
See Also:
Serialized Form

Constructor Summary
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.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NestedException

public NestedException(java.lang.String message,
                       java.lang.Exception except)
Construct a new nested exception wrapping an underlying exception and providing a message.

Parameters:
message - The exception message
except - The underlying exception

NestedException

public NestedException(java.lang.String message)
Construct a new nested with a message.

Parameters:
message - The exception message

NestedException

public NestedException(java.lang.Exception except)
Construct a new nested exception wrapping an underlying exception.

Parameters:
except - The underlying exception
Method Detail

getException

public java.lang.Exception getException()
Returns the underlying exception, if this exception wraps another exception.

Returns:
The underlying exception, or null

printStackTrace

public void printStackTrace()
Overrides Exception.printStackTrace to print the nested exception's stack trace, if there is one.

Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintStream stream)
Overrides Exception.printStackTrace to print the nested exception's stack trace, if there is one.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
stream - The stream to write the stack trace to.

printStackTrace

public void printStackTrace(java.io.PrintWriter writer)
Overrides Exception.printStackTrace to print the nested exception's stack trace, if there is one.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
writer - The writer to write the stack trace to.


Copyright ? 2002 Clarity Systems Group, LLC. All Rights Reserved.