Class TraceTool
java.lang.Object
com.aquima.interactions.foundation.exception.TraceTool
A Utility class helping in outputting stacktraces with support for old jdk1.3 EJB and JSP exceptions. Since they were
created without the use of getcause they use a getRootCause method.
- Since:
- 5.0
- Author:
- F. van der Meer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendTrace
(PrintStream ostream) Appends the stack trace to the PrintStream in a similar way of Throwable.printStackTrace.void
appendTrace
(Writer writer) Appends the stack trace to the Writer in a similar way of Throwable.printStackTrace.appendTrace
(StringBuffer buffer) Appends the stack trace to the StringBuffer in a similar way of Throwable.printStackTrace.asString()
Nice convenience method.boolean
hasCause()
This method returns the cause of the error, or null if none is available.
-
Constructor Details
-
TraceTool
Constructs a trace tool with a throwable.- Parameters:
error
- Should never be null
-
-
Method Details
-
appendTrace
Appends the stack trace to the StringBuffer in a similar way of Throwable.printStackTrace. The function tries to look for more rootcauses then only the one defined in Throwable.getCause.- Parameters:
buffer
- a StringBuffer to append the exception trace to.- Returns:
- The string buffer that was passed as argument to this method.
-
appendTrace
Appends the stack trace to the Writer in a similar way of Throwable.printStackTrace. The function tries to look for more rootcauses then only the one defined in Throwable.getCause.- Parameters:
writer
- a Writer to append the exception trace to.
-
appendTrace
Appends the stack trace to the PrintStream in a similar way of Throwable.printStackTrace. The function tries to look for more rootcauses then only the one defined in Throwable.getCause.- Parameters:
ostream
- a PrintStream to append the exception trace to.
-
hasCause
public boolean hasCause()This method returns the cause of the error, or null if none is available.- Returns:
- the cause of the error, or null if none is available.
-
asString
Nice convenience method. Note: This method is somewhat inefficient.- Returns:
- String the string which normally goes to the writer method.
-