com.arsdigita.util
Class CheckedWrapperException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bycom.arsdigita.util.CheckedWrapperException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HTMLParserConfigurationException, HTMLParserException

public class CheckedWrapperException
extends Exception

A checked wrapper exception that can be used to rethrow another exception. TODO: This should become a skeleton when/if we switch to Java 1.4. http://java.sun.com/j2se/1.4/docs/guide/lang/chained-exceptions.html The basic exception methods are overridden with methods that combine this wrapper and its root cause, so it can be treated just like any normal exception in actual use. Note that it is not necessary to provide a string along with a root cause; in particular, the following usage: new UncheckedWrapperException(e); is more correct than new UncheckedWrapperException(e.getMessage(), e);

Version:
$Id: //core-platform/dev/src/com/arsdigita/util/CheckedWrapperException.java#7 $
Author:
David Eison
See Also:
Serialized Form

Field Summary
static String versionId
           
 
Constructor Summary
CheckedWrapperException(String msg)
          Constructor which only takes a msg, which will cause this UncheckedWrapperException to behave like a normal RuntimeException.
CheckedWrapperException(String s, Throwable rootCause)
          Constructor which takes a message string and a root cause that this exception will be wrapping.
CheckedWrapperException(Throwable rootCause)
          Constructor which takes a root cause that this exception will be wrapping.
 
Method Summary
 String getMessage()
          This exception's message and the root cause's.
 Throwable getRootCause()
          Gets the root cause of this exception.
 boolean hasRootCause()
          Indicates if this exception has a root cause.
 void printStackTrace()
          Stack trace for the root cause.
 void printStackTrace(PrintStream s)
          Stack trace for the root cause.
 void printStackTrace(PrintWriter s)
          Stack trace for the root cause.
 String toString()
          Get a string representing this exception and the root cause.
 String toString(Class delegatingClass)
          Get a string representing this exception and the root cause.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

CheckedWrapperException

public CheckedWrapperException(String msg)
Constructor which only takes a msg, which will cause this UncheckedWrapperException to behave like a normal RuntimeException. While it doesn't seem to make a lot of sense to have a wrapper exception that doesn't wrap anything, this is needed so that it can be used as a direct replacement for RuntimeException.


CheckedWrapperException

public CheckedWrapperException(Throwable rootCause)
Constructor which takes a root cause that this exception will be wrapping.


CheckedWrapperException

public CheckedWrapperException(String s,
                               Throwable rootCause)
Constructor which takes a message string and a root cause that this exception will be wrapping. The message string should be something different than rootCause.getMessage() would normally provide.

Method Detail

hasRootCause

public boolean hasRootCause()
Indicates if this exception has a root cause.


getRootCause

public Throwable getRootCause()
Gets the root cause of this exception.


toString

public String toString()
Get a string representing this exception and the root cause.


toString

public String toString(Class delegatingClass)
Get a string representing this exception and the root cause. Functions like normal toString, except that the name of the provided class will be used instead of the name of the unchecked wrapper exception. Useful when another exception class is using an unchecked wrapper exception to delegate to.


getMessage

public String getMessage()
This exception's message and the root cause's.


printStackTrace

public void printStackTrace()
Stack trace for the root cause.


printStackTrace

public void printStackTrace(PrintStream s)
Stack trace for the root cause.


printStackTrace

public void printStackTrace(PrintWriter s)
Stack trace for the root cause.



Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC