Package org.jfree.util
Class StackableException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.jfree.util.StackableException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ObjectDescriptionException
,ObjectFactoryException
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:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a StackableRuntimeException with no message and no parent.StackableException
(String message) Creates an exception.StackableException
(String message, Exception ex) Creates an exception. -
Method Summary
Modifier and TypeMethodDescriptionReturns the parent exception (possibly null).void
Prints thisThrowable
and its backtrace to the standard error stream.void
printStackTrace
(PrintStream stream) Prints the stack trace to the specified stream.void
printStackTrace
(PrintWriter writer) Prints the stack trace to the specified writer.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, setStackTrace, toString
-
Constructor Details
-
StackableException
public StackableException()Creates a StackableRuntimeException with no message and no parent. -
StackableException
Creates an exception.- Parameters:
message
- the exception message.ex
- the parent exception.
-
StackableException
Creates an exception.- Parameters:
message
- the exception message.
-
-
Method Details
-
getParent
Returns the parent exception (possibly null).- Returns:
- the parent exception.
-
printStackTrace
Prints the stack trace to the specified stream.- Overrides:
printStackTrace
in classThrowable
- Parameters:
stream
- the output stream.
-
printStackTrace
Prints the stack trace to the specified writer.- Overrides:
printStackTrace
in classThrowable
- Parameters:
writer
- the writer.
-
printStackTrace
Prints thisThrowable
and its backtrace to the standard error stream. This method prints a stack trace for thisThrowable
object on the error output stream that is the value of the fieldSystem.err
. The first line of output contains the result of theThrowable.toString()
method for this object. Remaining lines represent data previously recorded by the methodThrowable.fillInStackTrace()
. The format of this information depends on the implementation, but the following example may be regarded as typical:
This example was produced by running the program:java.lang.NullPointerException at MyClass.mash(MyClass.java:9) at MyClass.crunch(MyClass.java:6) at MyClass.main(MyClass.java:3)
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 classThrowable
- See Also:
-