nested exceptions are displayed incorrectly with JellyException
---------------------------------------------------------------
Key: JELLY-235
URL: http://issues.apache.org/jira/browse/JELLY-235
Project: Commons Jelly
Issue Type: Improvement
Components: core / taglib.core
Affects Versions: 1.0
Reporter: Kohsuke Kawaguchi
Attachments: JELLY.diff
JellyException has some built-in support for nested exceptions. In particular,
when it displays a stack trace, it tries to also displays the nested exception,
which is great.
What's not so great is that when JDK 1.4 added this on its own, both Jelly and
JDK try to display the nested exceptions, and you ended up seeing O(n^2) stack
traces for n-level nested exception.
Imagine a situation where N JellyExceptions are nested inside each other.
With the following current printStackTrace:
{code}
public void printStackTrace() {
super.printStackTrace();
if (cause != null) {
System.out.println("Root cause");
cause.printStackTrace();
}
}
{code}
Outer JellyException prints its stack trace first (in which JDK prints out all
the nested exceptions),
and then JellyException prints the stack trace of the inner JellyException.
Then this same step is repeatedly, causing an output like this:
{noformat}
JellyExpception 3
Caused by JellyException 2
Caused by JellyException 1
Root cause:
JellyException 2
Caused by JellyException 1
Root cause:
JellyException 1
{noformat}
See the attached patch for one possible fix.
Personally, I don't mind if JellyException choose to completely stop trying to
print out the nested exception on its own, and simply delegate everything to
JDK. This will make the output worse on JDK 1.3 and earlier, but the # of
people using those is shrinking every day.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]