You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/01/31 02:20:33 UTC

DO NOT REPLY [Bug 48644] New: Code should never ignore throwable

https://issues.apache.org/bugzilla/show_bug.cgi?id=48644

           Summary: Code should never ignore throwable
           Product: Tomcat 7
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: sebb@apache.org


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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48644] Code should never ignore throwable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48644

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-04-24 15:27:54 EDT ---
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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48644] Code should never ignore throwable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48644

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Mark Thomas <ma...@apache.org> 2010-09-27 18:32:06 EDT ---
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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48644] Code should never ignore throwable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48644

Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #3 from Sebb <se...@apache.org> 2010-09-13 14:28:03 EDT ---
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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48644] Code should never ignore throwable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48644

--- Comment #1 from omegam1nus@hotmail.co.uk 2010-04-17 12:25:26 EDT ---
Created an attachment (id=25319)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25319)
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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48644] Code should never ignore throwable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48644

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikevdg@gulik.co.nz

--- Comment #6 from Konstantin Kolinko <kn...@gmail.com> 2012-03-01 03:37:12 UTC ---
*** Bug 52800 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48644] Code should never ignore throwable

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48644

--- Comment #4 from Sebb <se...@apache.org> 2010-09-13 14:38:17 EDT ---
Created an attachment (id=26023)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26023)
Sample patch to fix some of the instances

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org