★ wanayoo — archive 1999 http://sourceware.cygnus.com/kawa/api/gnu/mapping/WrappedException.htmlNouvelle recherche | Portail wanayoo

gnu.mapping
Class WrappedException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--gnu.mapping.WrappedException
Direct Known Subclasses:
WrongType

public class WrappedException
extends java.lang.RuntimeException

Encapsulate some Exception inside a RuntimeException. Inspired by org.xml.sax.SAXException written by David Megginson.

See Also:
Serialized Form

Constructor Summary
WrappedException(java.lang.Exception e)
          Create a new WrappedException wrapping an existing exception.
WrappedException(java.lang.String message)
          Create a new WrappedException.
WrappedException(java.lang.String message, java.lang.Exception e)
          Create a new WrappedException from an existing exception.
 
Method Summary
 java.lang.Exception getException()
          Return the embedded exception, if any.
 java.lang.String getMessage()
          Return a detail message for this exception.
 java.lang.String toString()
          Convert this exception to a string.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, printStackTrace, printStackTrace, printStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WrappedException

public WrappedException(java.lang.String message)
Create a new WrappedException.
Parameters:
message - The error or warning message.

WrappedException

public WrappedException(java.lang.Exception e)
Create a new WrappedException wrapping an existing exception.

The existing exception will be embedded in the new one, and its message will become the default message for the WrappedException.

Parameters:
e - The exception to be wrapped in a WrappedException.

WrappedException

public WrappedException(java.lang.String message,
                        java.lang.Exception e)
Create a new WrappedException from an existing exception.

The existing exception will be embedded in the new one, but the new exception will have its own message.

Parameters:
message - The detail message.
e - The exception to be wrapped in a WrappedException.
Method Detail

getMessage

public java.lang.String getMessage()
Return a detail message for this exception.

If there is a embedded exception, and if the WrappedException has no detail message of its own, this method will return the detail message from the embedded exception.

Overrides:
getMessage in class java.lang.Throwable
Returns:
The error or warning message.

getException

public java.lang.Exception getException()
Return the embedded exception, if any.
Returns:
The embedded exception, or null if there is none.

toString

public java.lang.String toString()
Convert this exception to a string.
Overrides:
toString in class java.lang.Throwable
Returns:
A string version of this exception.