Mark Thomas wrote:
Remy Maucherat wrote:
[EMAIL PROTECTED] wrote:
Author: markt
Date: Sat Jan 27 16:55:24 2007
New Revision: 500716
URL: http://svn.apache.org/viewvc?view=rev&rev=500716
Log:
Port fix bug 39088 that prevents infinite loops when an exception is
thrown the returns itself for getRootCause(). Also port changes that
enable the root cause to be found when the nesting is particularly
extreme.
Arrrrr, my eyes :D :D
TC 6 already used the clean mechanism (using getCause, which can also
display a lot more about the exception if proper wrapping was done by
the application), so reverting to the TC 5.5 hack is super evil. It also
had a recursion limit which seemed reasonable to me, and is going to be
more efficient than your check.
I have already done some cleaning and corrected the change log.
There are a couple of problem with getCause. The first is that is
doesn't unwrap a fairly frequent exception for web applications:
SQLException. The second is that it doesn't unwrap a JspException that
has used the JspException(Throwable) constructor.
An alternative approach that has since occurred to me is to modify
JspException in the same way as ServletException so the standard
exception chaining is always used. This would enable getCause to be
used in all cases apart from SQLException and allow a much cleaner
patch whilst retaining improved root cause identification.
Having now just looked at the JavaDoc for JspException in the JSP 2.1
final spec we have to make this change to be spec compliant.
getRootCause has been deprecated in favour of getCause.
I'll make the changes later today.
I think it's better if I veto this patch, then. The previous code was
simpler, complied with the new Java standard for exception nesting, and
had better protections against infinite loops. Using getCause is the
standard way of unwrapping exceptions, and should be used moving forward.
Note: I see you have fixed JspException as ServletException has been
fixed earlier.
Rémy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]