com.caplin.keymaster.error
Class WrappedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.caplin.keymaster.error.WrappedException
All Implemented Interfaces:
Serializable

public class WrappedException
extends Exception

This class provides a way of wrapping up all the different exceptions associated with KeyMaster. The class is used to handle many different exceptions that can be thrown as a result of the encryption, signature and token generation process. This type of exception is thrown by KeyMasters internal classes.

Author:
David Shorten
See Also:
Serialized Form

Field Summary
static String WRAPPED_MESSAGE
          This will contain the reason why the exception that was thrown.
 
Constructor Summary
WrappedException(Exception toWrap)
           Call the empty Exception constructor and initalise class varibales.
WrappedException(String message, Exception toWrap)
           Call the Exception constructor using the message parameter and set class varibales.
 
Method Summary
 Exception getWrappedException()
           Gets the Exception that this class was instantiated with.
 void printStackTraceDeep()
           Calls printStackTraceDeep(PrintWriter) with the standard system error output stream.
 void printStackTraceDeep(PrintStream ps)
           Casts the PrintStream into a PrintWriter and then calls printStackTraceDeep( PrintWriter pw ) belonging to this class.
 void printStackTraceDeep(PrintWriter pw)
           Calls the super method Throwable.printStackTrace(java.io.PrintWriter) to do a stack trace and then calls the same method belonging to the Exception this class was instantiated with.
 String toStringDeep()
           Get a detailed description of what has gone wrong and why this class has been instantiated.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WRAPPED_MESSAGE

public static final String WRAPPED_MESSAGE

This will contain the reason why the exception that was thrown. The mesasge will start with Wrapped exception:

See Also:
Constant Field Values
Constructor Detail

WrappedException

public WrappedException(String message,
                        Exception toWrap)

Call the Exception constructor using the message parameter and set class varibales.

Parameters:
message - the reason why this execption is being created.
toWrap - an exception which was thrown by code in the calling class.

WrappedException

public WrappedException(Exception toWrap)

Call the empty Exception constructor and initalise class varibales.

Parameters:
toWrap - an exception which was thrown by code in the calling class.
Method Detail

toStringDeep

public String toStringDeep()

Get a detailed description of what has gone wrong and why this class has been instantiated.

Returns:
Returns a short description of this throwable followed by WRAPPED_MESSAGE followed by the Exception passed to the constructor.

printStackTraceDeep

public void printStackTraceDeep()

Calls printStackTraceDeep(PrintWriter) with the standard system error output stream.


printStackTraceDeep

public void printStackTraceDeep(PrintWriter pw)

Calls the super method Throwable.printStackTrace(java.io.PrintWriter) to do a stack trace and then calls the same method belonging to the Exception this class was instantiated with.

Parameters:
pw - Any valid PrintWriter that corresponds to an output stream

printStackTraceDeep

public void printStackTraceDeep(PrintStream ps)

Casts the PrintStream into a PrintWriter and then calls printStackTraceDeep( PrintWriter pw ) belonging to this class.

Parameters:
ps - Any valid PrintStream that corresponds to an output stream.

getWrappedException

public Exception getWrappedException()

Gets the Exception that this class was instantiated with.

Returns:
the Excepetion that this class corresponds to.


Please send bug reports and comments to Caplin support