Bug 40241 - java.lang.Throwable is caught inappropriately
Summary: java.lang.Throwable is caught inappropriately
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Unknown (show other bugs)
Version: 5.5.17
Hardware: All All
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-12 19:28 UTC by J Ross Nicoll
Modified: 2006-12-25 06:07 UTC (History)
0 users



Attachments
Patch for SSI filter and servlet (10.45 KB, patch)
2006-08-12 19:29 UTC, J Ross Nicoll
Details | Diff
Patch for DefaultServlet (7.50 KB, patch)
2006-08-12 19:30 UTC, J Ross Nicoll
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description J Ross Nicoll 2006-08-12 19:28:28 UTC
In multiple places throughout the Tomcat source code, java.lang.Throwable is
caught, and dealt with as if it was an Exception subclass, meaning that
java.lang.Error subclasses may be ignored or dealt with inappropriately. I'm
making this as a bug to hold patches I've been working on, for this problem.
Comment 1 J Ross Nicoll 2006-08-12 19:29:01 UTC
Created attachment 18706 [details]
Patch for SSI filter and servlet
Comment 2 J Ross Nicoll 2006-08-12 19:30:26 UTC
Created attachment 18707 [details]
Patch for DefaultServlet

Please note the two methods getBooleanInitParameter() and getIntInitParameter()
- if someone with a better understanding of the Tomcat code layout could move
these into a utility class or similar, it would probably be better.
Comment 3 Remy Maucherat 2006-08-12 19:44:26 UTC
I am sure you mean well, but this is a bad idea, sorry. The only acceptable
change is for the parsing of the parameters, but it would need to be more
conservative than this.
Comment 4 Darryl Miles 2006-08-13 09:48:29 UTC
Perhaps Remy can elaborate on his reasoning for it being a bad idea so that
James can amend his patches.  Simply stating it is a bad idea without raising
your own concerns does not mean anything.
Comment 5 Yoav Shapira 2006-12-25 05:45:08 UTC
I too am not a big fan of just catching Throwables and treating them as
Exceptions.  I'm not going to touch the getXParameter code at the moment, but
will take a look at the catch(Throwable) parts.
Comment 6 Yoav Shapira 2006-12-25 06:07:53 UTC
OK, I've changed the classes (directly, not using your patches) to catch
Exceptions instead of Throwables, log them better, and generally be a little
better citizens in this regard.  Thanks for reporting this.