com.bowstreet.util
Class WrappedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.bowstreet.util.WrappedException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ProfileException, WebAppRuntimeException

public class WrappedException
extends java.lang.RuntimeException

Class for creating a RuntimeException wrapper from any Throwable exceptions. This can be used to re-throw non-runtime exceptions. If constructed with target exception the printStackTrace(..), getMessage() and toString() methods will use the target exception to produce their results.

See Also:
Serialized Form

Constructor Summary
WrappedException(java.lang.String msg)
          Constructs a WrappedException with a message.
WrappedException(java.lang.Throwable target)
          Constructs a WrappedException with a target exception.
WrappedException(java.lang.Throwable target, java.lang.String msg)
          Constructs a WrappedException with a target exception and a detail message.
 
Method Summary
 java.lang.String getMessage()
          Returns the error message string of this throwable object.
 java.lang.Object getProperty(java.lang.String key)
          Gets a property given the key.
 java.lang.Throwable getTargetException()
          Gets the thrown target exception.
 void printStackTrace()
          Prints the stack trace of the thrown target exception.
 void printStackTrace(java.io.PrintStream ps)
          Prints the stack trace of the thrown target exception to the specified print stream.
 void printStackTrace(java.io.PrintWriter pw)
          Prints the stack trace of the thrown target exception to the specified print writer.
 void putProperty(java.lang.String key, java.lang.Object value)
          Sets the specified property.
 java.lang.String toString()
          Returns a short description of this throwable object.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, setStackTrace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WrappedException

public WrappedException(java.lang.String msg)
Constructs a WrappedException with a message.

Parameters:
msg - The message for the exception.

WrappedException

public WrappedException(java.lang.Throwable target)
Constructs a WrappedException with a target exception.

Parameters:
target - The real execption.

WrappedException

public WrappedException(java.lang.Throwable target,
                        java.lang.String msg)
Constructs a WrappedException with a target exception and a detail message.

Parameters:
target - The real execption.
msg - The message for the exception.
Method Detail

getMessage

public java.lang.String getMessage()
Returns the error message string of this throwable object.

Overrides:
getMessage in class java.lang.Throwable
Returns:
The getMessage() value of the target exception.

getProperty

public java.lang.Object getProperty(java.lang.String key)
Gets a property given the key.

Parameters:
key - Specifies the property to get.
Returns:
The value of the specified property.

getTargetException

public java.lang.Throwable getTargetException()
Gets the thrown target exception.

Returns:
The target exception or null if none specified.

printStackTrace

public void printStackTrace()
Prints the stack trace of the thrown target exception.

Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintStream ps)
Prints the stack trace of the thrown target exception to the specified print stream.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
ps - Specifies the PrintStream to print the stack trace to.

printStackTrace

public void printStackTrace(java.io.PrintWriter pw)
Prints the stack trace of the thrown target exception to the specified print writer.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
pw - Specifies the PrintWriter to print the stack trace to.

putProperty

public void putProperty(java.lang.String key,
                        java.lang.Object value)
Sets the specified property.

Parameters:
key - Specifies the property to store.
value - Specifies the value to store.

toString

public java.lang.String toString()
Returns a short description of this throwable object.

Overrides:
toString in class java.lang.Throwable
Returns:
The toString() value of the target exception.


Copyright © 2009 IBM. All Rights Reserved.