|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object echopoint.util.throwable.ThrowableKit
ThrowableKit
provides helper methods for handling
Exceptions in Echo web applications. It is expecially useful
for allowing JDK 1.4 exception chaining while still retaining
a JDK 1.3 compliant code base.
Method Summary | |
static java.lang.Throwable |
attachCause(java.lang.Throwable throwable,
java.lang.Throwable cause)
This method attempts to attach the cause Throwable to the provided Throwable. |
static ThrowableDescriptor |
describeThrowable(java.lang.Throwable throwable)
This method will examine a Throwable and return a ThrowableDescriptor that can then be used to output error details. |
static java.lang.Throwable |
initCause(java.lang.Throwable throwable,
java.lang.Throwable cause)
Short hand method for ThrowableKit.attachCause(throwable, cause); |
static java.lang.RuntimeException |
makeRuntimeException(java.lang.String message,
java.lang.Throwable cause)
This method creates a RuntimeException that will attach the root cause if you are running under JDK 1.4 or later. |
static java.lang.RuntimeException |
makeRuntimeException(java.lang.Throwable cause)
A short cut method for ThrowableKit.makeRuntimeException(null,cause); |
static java.lang.Throwable |
makeThrowable(java.lang.Class throwableClass,
java.lang.String message,
java.lang.Throwable cause)
This method creates a Throwable derived object that will attach the root cause if you are running under JDK 1.4 or later. |
static java.lang.Throwable |
makeThrowable(java.lang.Class throwableClass,
java.lang.Throwable cause)
Short hand method for ThrowableKit.makeThrowable(throwableClass, null,cause); |
static void |
printThrowableDescription(java.lang.Throwable throwable,
java.io.PrintStream out)
Shorthand method for ThrowableKit.printThrowableDescription(throwable,out,true); |
static void |
printThrowableDescription(java.lang.Throwable throwable,
java.io.PrintStream out,
boolean indent)
Prints a textual description of a Throwable and its properties, causes and stack traces. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.Throwable makeThrowable(java.lang.Class throwableClass, java.lang.String message, java.lang.Throwable cause)
This method makes it easier in dumps that find the root cause of a problem.
If the contructor(String,Throwable) is not available (JDK 1.3 or below) then the message + " : " + cause.toString() will be used and the root cause Throwable stack trace will not be avalable.
This method allows you to use the new 1.4 exception chaining if possible.
throwableClass
- - must be a class derived from Throwable.classmessage
- - a custom error message, can be null.cause
- - the root cause Throwable
public static java.lang.Throwable makeThrowable(java.lang.Class throwableClass, java.lang.Throwable cause)
makeThrowable(Class, String, Throwable)
public static java.lang.RuntimeException makeRuntimeException(java.lang.String message, java.lang.Throwable cause)
This method allows you to use the new 1.4 exception chaining if possible.
message
- - a custom error message, can be null.cause
- - the root cause Throwable
public static java.lang.RuntimeException makeRuntimeException(java.lang.Throwable cause)
makeRuntimeException(String, Throwable)
public static java.lang.Throwable attachCause(java.lang.Throwable throwable, java.lang.Throwable cause)
If this cant be done then nothing is attached, such as when you are running under JDK 1.3
This method can be called at most once on an Throwable. It is generally called from
within the constructor, or immediately after creating the
throwable. If this throwable was created with Throwable.Throwable(Throwable)
or
Throwable.Throwable(String,Throwable)
, this method has no effect since
the cause has already been set.
throwable
- the target Throwablecause
- the root cause Throwablew to attach
public static java.lang.Throwable initCause(java.lang.Throwable throwable, java.lang.Throwable cause)
attachCause(Throwable, Throwable)
,
Throwable.initCause(java.lang.Throwable)
public static ThrowableDescriptor describeThrowable(java.lang.Throwable throwable)
This works equally well on JDK 1.3 as it does on JDK 1.4.
Any circular references in the Exception chaining will be removed.
throwable
- - the Throwable to examine
public static void printThrowableDescription(java.lang.Throwable throwable, java.io.PrintStream out, boolean indent)
throwable
- - the Throwable in questionout
- - the PrintStream to write toindent
- - control whether tab indents will be usedpublic static void printThrowableDescription(java.lang.Throwable throwable, java.io.PrintStream out)
printThrowableDescription(Throwable, PrintStream, boolean)
|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |