Bug 40241

Summary: java.lang.Throwable is caught inappropriately
Product: Tomcat 5 Reporter: J Ross Nicoll <jrn2005>
Component: UnknownAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: 5.5.17   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch for SSI filter and servlet
Patch for DefaultServlet

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.