|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry.util.exception.ExceptionAnalyzer
public class ExceptionAnalyzer
Analyzes an exception, creating one or more
ExceptionDescription
s
from it.
Constructor Summary | |
---|---|
ExceptionAnalyzer()
|
Method Summary | |
---|---|
ExceptionDescription[] |
analyze(Throwable exception)
Analyzes the exceptions. |
protected Throwable |
buildDescription(Throwable exception)
|
protected String[] |
getStackTrace(Throwable exception)
Gets the stack trace for the exception, and converts it into an array of strings. |
boolean |
isExhaustive()
If true, then stack trace is extracted for each exception. |
void |
reportException(Throwable exception,
PrintStream stream)
Produces a text based exception report to the provided stream. |
void |
setExhaustive(boolean value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExceptionAnalyzer()
Method Detail |
---|
public boolean isExhaustive()
public void setExhaustive(boolean value)
public ExceptionDescription[] analyze(Throwable exception)
ExceptionDescription
for the
exception. It also looks for a non-null Throwable
property. If one exists, then a second ExceptionDescription
is created. This continues until no more nested exceptions can be found.
The description includes a set of name/value properties
(as ExceptionProperty
) object. This list contains all
non-null properties that are not, themselves, Throwable
.
The name is the display name (not the logical name) of the property. The value
is the toString()
value of the property.
Only properties defined in subclasses of Throwable
are included.
A future enhancement will be to alphabetically sort the properties by name.
protected Throwable buildDescription(Throwable exception)
protected String[] getStackTrace(Throwable exception)
This involves parsing the
string generated indirectly from
Throwable.printStackTrace(PrintWriter)
. This method can get confused
if the message (presumably, the first line emitted by printStackTrace())
spans multiple lines.
Different JVMs format the exception in different ways.
A possible expansion would be more flexibility in defining the pattern used. Hopefully all 'mainstream' JVMs are close enough for this to continue working.
public void reportException(Throwable exception, PrintStream stream)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |