There seem to be quite a few places where code catches Throwable and ignores it. For example: ant.jmx.JMXAccessorQueryTask.bindAttributes ant.jmx.JMXAccessorTask.execute core.StandardContext - lots of methods In most cases, catching Exception would be enough.
Created attachment 25319 [details] proposed patch for bug 48644 Have created a new class and method to deal with all instances where the code catches Throwable and ignores it. The method checks whether the Throwable is something that needs to be rethrown (such as ThreadDeath or VirtualMachineError) and rethrows it if this is the case and swallows everything else. If there are any other types of Throwable that need to be dealt with instead of swallowed then they can be added to this method.
Many thanks for the patch. This has been applied to Tomcat 7.0.x and will be included in 7.0.0 onwards. I made one small change. Jasper (org.apache.jasper) is often used as a stand-alone module so it can't depend on any external classes. Therefore, I gave Jasper its own copy of ExceptionUtils.
There are still lots of places where Throwable is caught. In most (all?) cases, catching Throwable is unnecessary - Exception would do just as well. Or indeed a more specific one such as IOException. Where the code really does need to catch Throwable, then the ExceptionUtils method must be used. There are also many cases where this has not been done.
Created attachment 26023 [details] Sample patch to fix some of the instances
Fixed in 7.0.x. Will be in 7.0.3 onwards. There are almost certainly some places where Throwable could be replaced with a more specific exception. Those can be handled as separate enhancement requests.
*** Bug 52800 has been marked as a duplicate of this bug. ***