org.jfree.util
Class StackableException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.jfree.util.StackableException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ObjectDescriptionException, ObjectFactoryException

public abstract class StackableException
extends java.lang.Exception

A baseclass for exceptions, which could have parent exceptions. These parent exceptions are raised in a subclass and are now wrapped into a subclass of this Exception.

The parents are printed when this exception is printed. This class exists mainly for debugging reasons, as with them it is easier to detect the root cause of an error.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
StackableException()
          Creates a StackableRuntimeException with no message and no parent.
StackableException(java.lang.String message)
          Creates an exception.
StackableException(java.lang.String message, java.lang.Exception ex)
          Creates an exception.
 
Method Summary
 java.lang.Exception getParent()
          Returns the parent exception (possibly null).
 void printStackTrace()
          Prints this Throwable and its backtrace to the standard error stream.
 void printStackTrace(java.io.PrintStream stream)
          Prints the stack trace to the specified stream.
 void printStackTrace(java.io.PrintWriter writer)
          Prints the stack trace to the specified writer.
 
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
 

Constructor Detail

StackableException

public StackableException()
Creates a StackableRuntimeException with no message and no parent.


StackableException

public StackableException(java.lang.String message,
                          java.lang.Exception ex)
Creates an exception.

Parameters:
message - the exception message.
ex - the parent exception.

StackableException

public StackableException(java.lang.String message)
Creates an exception.

Parameters:
message - the exception message.
Method Detail

getParent

public java.lang.Exception getParent()
Returns the parent exception (possibly null).

Returns:
the parent exception.

printStackTrace

public void printStackTrace(java.io.PrintStream stream)
Prints the stack trace to the specified stream.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
stream - the output stream.

printStackTrace

public void printStackTrace(java.io.PrintWriter writer)
Prints the stack trace to the specified writer.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
writer - the writer.

printStackTrace

public void printStackTrace()
Prints this Throwable and its backtrace to the standard error stream. This method prints a stack trace for this Throwable object on the error output stream that is the value of the field System.err. The first line of output contains the result of the Throwable.toString() method for this object. Remaining lines represent data previously recorded by the method Throwable.fillInStackTrace(). The format of this information depends on the implementation, but the following example may be regarded as typical:
 java.lang.NullPointerException
         at MyClass.mash(MyClass.java:9)
         at MyClass.crunch(MyClass.java:6)
         at MyClass.main(MyClass.java:3)
 
This example was produced by running the program:

 class MyClass {

     public static void main(String[] argv) {
         crunch(null);
     }
     static void crunch(int[] a) {
         mash(a);
     }

     static void mash(int[] b) {
         System.out.println(b[0]);
     }
 }
 

Overrides:
printStackTrace in class java.lang.Throwable
See Also:
System.err