org.gjt.rec.util
Class PackingException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--org.gjt.rec.util.PackingException
All Implemented Interfaces:
Serializable

public class PackingException
extends Exception

A checked exception that wraps another exception. When the stack trace of this exception is printed, it will appear as the stack trace of the exception that is packed inside this one.

This is very similar to InvocationTargetException, the only difference being that this class has a protected constructor that allows it to be used just with a message and not wrapping another exception. This is because classes derived from this one might well want to use both mechanisms without having to declare two types of exception thrown from methods.

Author:
Neil Stockbridge
See Also:
InvocationTargetException, Serialized Form

Field Summary
static String REVISION
           
 
Constructor Summary
PackingException()
          Constructs a PackingException with no message or packed exception.
PackingException(String message)
          Constructs a PackingException with a particular message but no packed exception.
PackingException(Throwable packedException)
          Constructs a PackingException with a particular packed exception.
PackingException(Throwable packedException, String message)
          Constructs a PackingException with a particular packed exception and a particular message.
 
Method Summary
 Throwable getPackedException()
          Retrieves the exception packed inside this one.
 void printStackTrace()
           
 void printStackTrace(PrintStream ps)
           
 void printStackTrace(PrintWriter pw)
           
 
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
 

Field Detail

REVISION

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

PackingException

public PackingException()
Constructs a PackingException with no message or packed exception. The stack trace of this exception will be it own.


PackingException

public PackingException(String message)
Constructs a PackingException with a particular message but no packed exception. The stack trace of this exception will be it own.

Parameters:
message - the message for this exception.

PackingException

public PackingException(Throwable packedException)
Constructs a PackingException with a particular packed exception. The message and stack trace of this exception will be the message from the packed exception.

Parameters:
packedException - the exception to pack inside this one.
Throws:
NullPointerException - if (packedException) is null

PackingException

public PackingException(Throwable packedException,
                        String message)
Constructs a PackingException with a particular packed exception and a particular message. The stack trace of this exception will be the stack trace from the packed exception, but the message will be the one supplied.

Parameters:
packedException - the exception to pack inside this one.
message - the message for this exception.
Throws:
NullPointerException - if (packedException) is null
Method Detail

getPackedException

public Throwable getPackedException()
Retrieves the exception packed inside this one.

Returns:
the exception packed inside this one.

printStackTrace

public void printStackTrace()
Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace(PrintStream ps)
Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace(PrintWriter pw)
Overrides:
printStackTrace in class Throwable