tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r937680 - in /tomcat/trunk/java/org/apache: catalina/ant/ catalina/core/ catalina/ha/session/ catalina/manager/ catalina/manager/host/ catalina/mbeans/ catalina/realm/ catalina/session/ catalina/ssi/ catalina/startup/ catalina/users/ catali...
Date Sat, 24 Apr 2010 19:26:18 GMT
Author: markt
Date: Sat Apr 24 19:26:17 2010
New Revision: 937680

URL: http://svn.apache.org/viewvc?rev=937680&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48644
Don't silently swallow Throwables that need to be re-thrown
Patch provided by Charlotte H (with a few tweaks)
Patch developed during the London GDC OS Jumpstart 2010

Added:
    tomcat/trunk/java/org/apache/jasper/util/ExceptionUtils.java   (with props)
    tomcat/trunk/java/org/apache/tomcat/util/ExceptionUtils.java   (with props)
Modified:
    tomcat/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java
    tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
    tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java
    tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
    tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java
    tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
    tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java
    tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java
    tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
    tomcat/trunk/java/org/apache/catalina/session/StandardManager.java
    tomcat/trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java
    tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
    tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
    tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java
    tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java
    tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java
    tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
    tomcat/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java
    tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
    tomcat/trunk/java/org/apache/jasper/servlet/JspCServletContext.java

Modified: tomcat/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java Sat Apr 24 19:26:17
2010
@@ -26,6 +26,7 @@ import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLConnection;
 import org.apache.catalina.util.Base64;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 
@@ -272,7 +273,7 @@ public abstract class AbstractCatalinaTa
                 try {
                     reader.close();
                 } catch (Throwable u) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(u);
                 }
                 reader = null;
             }
@@ -280,7 +281,7 @@ public abstract class AbstractCatalinaTa
                 try {
                     istream.close();
                 } catch (Throwable u) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(u);
                 }
                 istream = null;
             }

Modified: tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java Sat Apr 24 19:26:17
2010
@@ -24,6 +24,7 @@ import java.lang.reflect.Method;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleEvent;
 import org.apache.catalina.LifecycleListener;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -162,7 +163,7 @@ public class AprLifecycleListener
                 // is below required.                
                 terminateAPR();
             } catch (Throwable t) {
-                // Ignore
+                ExceptionUtils.handleThrowable(t);
             }
             return;
         }

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java Sat Apr 24 19:26:17 2010
@@ -34,6 +34,7 @@ import org.apache.catalina.util.Lifecycl
 import org.apache.catalina.valves.ValveBase;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.modeler.Registry;
 
 
@@ -315,7 +316,7 @@ public class StandardPipeline extends Li
                 try {
                     ((Contained) oldBasic).setContainer(null);
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
             }
         }

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java Sat Apr 24 19:26:17 2010
@@ -60,6 +60,7 @@ import org.apache.catalina.util.Instance
 import org.apache.catalina.util.LifecycleBase;
 import org.apache.tomcat.InstanceManager;
 import org.apache.tomcat.PeriodicEventListener;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.log.SystemLogHandler;
 import org.apache.tomcat.util.modeler.Registry;
 
@@ -585,7 +586,7 @@ public class StandardWrapper
         try {
             loadServlet();
         } catch (Throwable t) {
-            // Ignore
+            ExceptionUtils.handleThrowable(t);
         }
         return (singleThreadModel);
 

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java Sat Apr 24 19:26:17
2010
@@ -43,6 +43,7 @@ import org.apache.catalina.ha.tcp.Replic
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.io.ReplicationStream;
 import org.apache.catalina.util.LifecycleBase;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.catalina.ha.ClusterManager;
 
@@ -978,8 +979,8 @@ public class DeltaManager extends Cluste
                 continue;
             try {
                 session.expire(true, isExpireSessionsOnShutdown());
-            } catch (Throwable ignore) {
-                // Ignore
+            } catch (Throwable t) {
+                ExceptionUtils.handleThrowable(t);
             } 
         }
 

Modified: tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java Sat Apr 24 19:26:17
2010
@@ -56,6 +56,7 @@ import org.apache.catalina.core.Standard
 import org.apache.catalina.core.StandardServer;
 import org.apache.catalina.util.RequestUtil;
 import org.apache.catalina.util.ServerInfo;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.tomcat.util.modeler.Registry;
 
@@ -442,7 +443,7 @@ public class ManagerServlet
             value = getServletConfig().getInitParameter("debug");
             debug = Integer.parseInt(value);
         } catch (Throwable t) {
-            // Ignore
+            ExceptionUtils.handleThrowable(t);
         }
 
         // Acquire global JNDI resources if available
@@ -1348,7 +1349,7 @@ public class ManagerServlet
                     // Try to stop the context first to be nicer
                     context.stop();
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
                 try {
                     if (path.lastIndexOf('/') > 0) {
@@ -1560,7 +1561,7 @@ public class ManagerServlet
                 try {
                     ostream.close();
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
                 ostream = null;
             }
@@ -1568,7 +1569,7 @@ public class ManagerServlet
                 try {
                     istream.close();
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
                 istream = null;
             }

Modified: tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java Sat Apr 24 19:26:17
2010
@@ -33,6 +33,7 @@ import javax.management.ObjectName;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.catalina.util.RequestUtil;
+import org.apache.tomcat.util.ExceptionUtils;
 
 /**
  * This is a refactoring of the servlet to externalize
@@ -158,7 +159,7 @@ public class StatusTransformer {
             method.invoke(null, paramValues);
             ok = true;
         } catch (Throwable t) {
-            // Ignore
+            ExceptionUtils.handleThrowable(t);
         }
         
         if (ok) {

Modified: tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java Sat Apr 24
19:26:17 2010
@@ -42,6 +42,7 @@ import org.apache.catalina.Host;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.core.StandardHost;
 import org.apache.catalina.startup.HostConfig;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.tomcat.util.modeler.Registry;
 import org.apache.catalina.core.ContainerBase;
@@ -316,7 +317,7 @@ public class HostManagerServlet
             value = getServletConfig().getInitParameter("debug");
             debug = Integer.parseInt(value);
         } catch (Throwable t) {
-            // Ignore
+            ExceptionUtils.handleThrowable(t);
         }
 
     }

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java Sat Apr 24 19:26:17 2010
@@ -54,6 +54,7 @@ import org.apache.coyote.ajp.AjpProtocol
 import org.apache.coyote.http11.Http11AprProtocol;
 import org.apache.coyote.http11.Http11NioProtocol;
 import org.apache.coyote.http11.Http11Protocol;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.IntrospectionUtils;
 import org.apache.tomcat.util.modeler.ManagedBean;
 import org.apache.tomcat.util.modeler.Registry;
@@ -1617,7 +1618,7 @@ public class MBeanUtils {
         try {
             ((Contained)valve).setContainer(null);
         } catch (Throwable t) {
-            // Ignore
+            ExceptionUtils.handleThrowable(t);
         }
         if( mserver.isRegistered(oname) ) {
             mserver.unregisterMBean(oname);

Modified: tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java Sat Apr 24 19:26:17 2010
@@ -30,6 +30,7 @@ import java.util.Properties;
 
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.util.LifecycleBase;
+import org.apache.tomcat.util.ExceptionUtils;
 
 
 /**
@@ -450,7 +451,7 @@ public class JDBCRealm
         try {
             preparedCredentials.close();
         } catch (Throwable f) {
-            // Ignore
+            ExceptionUtils.handleThrowable(f);
         }
         this.preparedCredentials = null;
 
@@ -458,7 +459,7 @@ public class JDBCRealm
         try {
             preparedRoles.close();
         } catch (Throwable f) {
-            // Ignore
+            ExceptionUtils.handleThrowable(f);
         }
         this.preparedRoles = null;
 

Modified: tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java Sat Apr 24 19:26:17 2010
@@ -23,6 +23,7 @@ import org.apache.catalina.Loader;
 import org.apache.catalina.Session;
 import org.apache.catalina.util.CustomObjectInputStream;
 import org.apache.catalina.util.LifecycleBase;
+import org.apache.tomcat.util.ExceptionUtils;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
@@ -901,41 +902,41 @@ public class JDBCStore extends StoreBase
         try {
             preparedSizeSql.close();
         } catch (Throwable f) {
-            // Ignore
+            ExceptionUtils.handleThrowable(f);
         }
         this.preparedSizeSql = null;
 
         try {
             preparedKeysSql.close();
         } catch (Throwable f) {
-            // Ignore
+            ExceptionUtils.handleThrowable(f);
         }
         this.preparedKeysSql = null;
 
         try {
             preparedSaveSql.close();
         } catch (Throwable f) {
-            // Ignore
+            ExceptionUtils.handleThrowable(f);
         }
         this.preparedSaveSql = null;
 
         try {
             preparedClearSql.close();
         } catch (Throwable f) {
-            // Ignore
+            ExceptionUtils.handleThrowable(f);
         }
          
 		try {
             preparedRemoveSql.close();
         } catch (Throwable f) {
-            // Ignore
+            ExceptionUtils.handleThrowable(f);
         }
         this.preparedRemoveSql = null;
 
         try {
             preparedLoadSql.close();
         } catch (Throwable f) {
-            // Ignore
+            ExceptionUtils.handleThrowable(f);
         }
         this.preparedLoadSql = null;
 

Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java Sat Apr 24 19:26:17 2010
@@ -50,6 +50,7 @@ import org.apache.catalina.Session;
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.core.StandardHost;
 import org.apache.catalina.util.LifecycleBase;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -402,7 +403,7 @@ public abstract class ManagerBase extend
                 method.invoke(null, paramValues);
                 apr = true;
             } catch (Throwable t) {
-                // Ignore
+                ExceptionUtils.handleThrowable(t);
             }
             if (apr) {
                 setEntropy(new String(result));

Modified: tomcat/trunk/java/org/apache/catalina/session/StandardManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardManager.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StandardManager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardManager.java Sat Apr 24 19:26:17
2010
@@ -47,6 +47,7 @@ import org.apache.catalina.util.Lifecycl
 import org.apache.catalina.security.SecurityUtil;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.ExceptionUtils;
 /**
  * Standard implementation of the <b>Manager</b> interface that provides
  * simple session persistence across restarts of this component (such as
@@ -547,7 +548,7 @@ public class StandardManager extends Man
             try {
                 session.expire(false);
             } catch (Throwable t) {
-                // Ignore
+                ExceptionUtils.handleThrowable(t);
             } finally {
                 session.recycle();
             }
@@ -621,7 +622,7 @@ public class StandardManager extends Man
                     session.expire();
                 }
             } catch (Throwable t) {
-                // Ignore
+                ExceptionUtils.handleThrowable(t);
             } finally {
                 // Measure against memory leaking if references to the session
                 // object are kept in a shared field somewhere

Modified: tomcat/trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ssi/ResponseIncludeWrapper.java Sat Apr 24 19:26:17
2010
@@ -31,6 +31,8 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponseWrapper;
 
+import org.apache.tomcat.util.ExceptionUtils;
+
 /**
  * A HttpServletResponseWrapper, used from
  * <code>SSIServletExternalResolver</code>
@@ -228,7 +230,7 @@ public class ResponseIncludeWrapper exte
                     lastModified = RFC1123_FORMAT.parse(value).getTime();
                 }
             } catch (Throwable ignore) {
-                // Ignore
+                ExceptionUtils.handleThrowable(ignore);
             }
         } else if (lname.equals(CONTENT_TYPE)) {
             contentType = value;
@@ -254,7 +256,7 @@ public class ResponseIncludeWrapper exte
                     lastModified = RFC1123_FORMAT.parse(value).getTime();
                 }
             } catch (Throwable ignore) {
-                // Ignore
+                ExceptionUtils.handleThrowable(ignore);
             }
         }
         else if (lname.equals(CONTENT_TYPE))

Modified: tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java Sat Apr 24 19:26:17
2010
@@ -25,6 +25,8 @@ import java.net.URL;
 import java.util.Enumeration;
 import java.util.Properties;
 
+import org.apache.tomcat.util.ExceptionUtils;
+
 
 /**
  * Utility class to read the bootstrap Catalina configuration.
@@ -91,7 +93,7 @@ public class CatalinaProperties {
                 is = (new URL(configUrl)).openStream();
             }
         } catch (Throwable t) {
-            // Ignore
+            ExceptionUtils.handleThrowable(t);
         }
 
         if (is == null) {
@@ -101,7 +103,7 @@ public class CatalinaProperties {
                 File properties = new File(conf, "catalina.properties");
                 is = new FileInputStream(properties);
             } catch (Throwable t) {
-                // Ignore
+                ExceptionUtils.handleThrowable(t);
             }
         }
 
@@ -110,7 +112,7 @@ public class CatalinaProperties {
                 is = CatalinaProperties.class.getResourceAsStream
                     ("/org/apache/catalina/startup/catalina.properties");
             } catch (Throwable t) {
-                // Ignore
+                ExceptionUtils.handleThrowable(t);
             }
         }
 

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Sat Apr 24 19:26:17 2010
@@ -48,6 +48,7 @@ import javax.servlet.ServletContainerIni
 import javax.servlet.ServletContext;
 import javax.servlet.annotation.HandlesTypes;
 
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.bcel.classfile.AnnotationElementValue;
 import org.apache.tomcat.util.bcel.classfile.AnnotationEntry;
 import org.apache.tomcat.util.bcel.classfile.ArrayElementValue;
@@ -1730,7 +1731,7 @@ public class ContextConfig
                             try {
                                 is.close();
                             } catch (Throwable t) {
-                                // ignore
+                                ExceptionUtils.handleThrowable(t);
                             }
                         }
                     }
@@ -1743,7 +1744,7 @@ public class ContextConfig
                 try {
                     jarFile.close();
                 } catch (Throwable t) {
-                    // ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
             }
         }
@@ -1788,7 +1789,7 @@ public class ContextConfig
                             try {
                                 is.close();
                             } catch (Throwable t) {
-                                // ignore
+                                ExceptionUtils.handleThrowable(t);
                             }
                         }
                     }
@@ -1820,7 +1821,7 @@ public class ContextConfig
                     try {
                         fis.close();
                     } catch (Throwable t) {
-                        // ignore
+                        ExceptionUtils.handleThrowable(t);
                     }
                 }
             }
@@ -2087,14 +2088,14 @@ public class ContextConfig
                     try {
                         jarFile.close();
                     } catch (Throwable t) {
-                        // ignore
+                        ExceptionUtils.handleThrowable(t);
                     }
                 }
                 if (stream != null) {
                     try {
                         stream.close();
                     } catch (Throwable t) {
-                        // ignore
+                        ExceptionUtils.handleThrowable(t);
                     }
                 }
                 fragment.setURL(urlConn.getURL());
@@ -2126,7 +2127,7 @@ public class ContextConfig
                     try {
                         stream.close();
                     } catch (Throwable t) {
-                        // ignore
+                        ExceptionUtils.handleThrowable(t);
                     }
                 }
                 if (fragment == null) {

Modified: tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java Sat Apr 24 19:26:17 2010
@@ -32,6 +32,7 @@ import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
 import org.apache.catalina.Host;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -153,7 +154,7 @@ public class ExpandWar {
                 try {
                     input.close();
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
                 input = null;
             }
@@ -161,7 +162,7 @@ public class ExpandWar {
                 try {
                     jarFile.close();
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
                 jarFile = null;
             }
@@ -228,7 +229,7 @@ public class ExpandWar {
                 try {
                     jarFile.close();
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
                 jarFile = null;
             }

Modified: tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Sat Apr 24 19:26:17 2010
@@ -49,6 +49,7 @@ import org.apache.catalina.core.Standard
 import org.apache.catalina.util.IOTools;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.tomcat.util.digester.Digester;
 import org.apache.tomcat.util.modeler.Registry;
@@ -872,7 +873,7 @@ public class HostConfig
                     try {
                         ostream.close();
                     } catch (Throwable t) {
-                        // Ignore
+                        ExceptionUtils.handleThrowable(t);
                     }
                     ostream = null;
                 }
@@ -880,7 +881,7 @@ public class HostConfig
                     try {
                         istream.close();
                     } catch (Throwable t) {
-                        // Ignore
+                        ExceptionUtils.handleThrowable(t);
                     }
                     istream = null;
                 }
@@ -890,7 +891,7 @@ public class HostConfig
                     try {
                         jar.close();
                     } catch (Throwable t) {
-                        // Ignore
+                        ExceptionUtils.handleThrowable(t);
                     }
                     jar = null;
                 }
@@ -942,7 +943,7 @@ public class HostConfig
                             try {
                                 istream.close();
                             } catch (Throwable t) {
-                                // Ignore
+                                ExceptionUtils.handleThrowable(t);
                             }
                             istream = null;
                         }
@@ -952,7 +953,7 @@ public class HostConfig
                             try {
                                 jar.close();
                             } catch (Throwable t) {
-                                // Ignore
+                                ExceptionUtils.handleThrowable(t);
                             }
                             jar = null;
                         }

Modified: tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java Sat Apr 24 19:26:17 2010
@@ -45,6 +45,7 @@ import org.apache.catalina.core.Standard
 import org.apache.catalina.core.StandardHost;
 import org.apache.tomcat.JarScanner;
 import org.apache.tomcat.JarScannerCallback;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.tomcat.util.digester.Digester;
 import org.xml.sax.InputSource;
@@ -518,7 +519,7 @@ public final class TldConfig  implements
                 try {
                     jarFile.close();
                 } catch (Throwable t) {
-                    // ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
             }
         }

Modified: tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java Sat Apr 24 19:26:17
2010
@@ -31,6 +31,7 @@ import org.apache.catalina.Group;
 import org.apache.catalina.Role;
 import org.apache.catalina.User;
 import org.apache.catalina.UserDatabase;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -412,7 +413,7 @@ public class MemoryUserDatabase implemen
                     try {
                         fis.close();
                     } catch (Throwable t) {
-                        // Ignore
+                        ExceptionUtils.handleThrowable(t);
                     }
                     throw e;
                 }

Modified: tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java Sat Apr 24 19:26:17
2010
@@ -35,6 +35,7 @@ import javax.naming.directory.DirContext
 
 import org.apache.catalina.Context;
 import org.apache.naming.resources.Resource;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
 
@@ -168,7 +169,7 @@ public final class ExtensionValidator {
                 try {
                     inputStream.close();
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
             }
         }
@@ -207,7 +208,7 @@ public final class ExtensionValidator {
                 try {
                     inputStream.close();
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
             }
         }
@@ -398,7 +399,7 @@ public final class ExtensionValidator {
                 try {
                     jin.close();
                 } catch (Throwable t) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
             }
         }

Modified: tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java Sat Apr 24 19:26:17
2010
@@ -30,6 +30,7 @@ import org.apache.catalina.connector.Req
 import org.apache.catalina.connector.Response;
 import org.apache.catalina.util.RequestUtil;
 import org.apache.catalina.util.ServerInfo;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -139,7 +140,7 @@ public class ErrorReportValve extends Va
         try {
             report(request, response, throwable);
         } catch (Throwable tt) {
-            // Ignore
+            ExceptionUtils.handleThrowable(tt);
         }
 
     }
@@ -176,7 +177,7 @@ public class ErrorReportValve extends Va
         try {
             report = sm.getString("http." + statusCode, message);
         } catch (Throwable t) {
-            // Ignore
+            ExceptionUtils.handleThrowable(t);
         }
         if (report == null)
             return;

Modified: tomcat/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java Sat Apr 24 19:26:17
2010
@@ -34,6 +34,7 @@ import org.apache.catalina.LifecycleStat
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.catalina.util.LifecycleBase;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -575,7 +576,7 @@ public final class JDBCAccessLogValve ex
         try {
             ps.close();
         } catch (Throwable f) {
-            // Ignore
+            ExceptionUtils.handleThrowable(f);
         }
         this.ps = null;
 

Modified: tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java Sat Apr 24 19:26:17
2010
@@ -34,6 +34,7 @@ import java.util.jar.JarFile;
 import javax.servlet.ServletContext;
 
 import org.apache.jasper.JasperException;
+import org.apache.jasper.util.ExceptionUtils;
 import org.apache.jasper.xmlparser.ParserUtils;
 import org.apache.jasper.xmlparser.TreeNode;
 import org.apache.tomcat.JarScanner;
@@ -388,7 +389,7 @@ public class TldLocationsCache {
                 try {
                     jarFile.close();
                 } catch (Throwable t) {
-                    // ignore
+                    ExceptionUtils.handleThrowable(t);
                 }
             }
         }

Modified: tomcat/trunk/java/org/apache/jasper/servlet/JspCServletContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JspCServletContext.java?rev=937680&r1=937679&r2=937680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/servlet/JspCServletContext.java (original)
+++ tomcat/trunk/java/org/apache/jasper/servlet/JspCServletContext.java Sat Apr 24 19:26:17
2010
@@ -44,6 +44,8 @@ import javax.servlet.SessionTrackingMode
 import javax.servlet.FilterRegistration.Dynamic;
 import javax.servlet.descriptor.JspConfigDescriptor;
 
+import org.apache.jasper.util.ExceptionUtils;
+
 
 /**
  * Simple <code>ServletContext</code> implementation without
@@ -267,7 +269,7 @@ public class JspCServletContext implemen
                 try {
                     is.close();
                 } catch (Throwable t2) {
-                    // Ignore
+                    ExceptionUtils.handleThrowable(t2);
                 }
             }
         }

Added: tomcat/trunk/java/org/apache/jasper/util/ExceptionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/util/ExceptionUtils.java?rev=937680&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/util/ExceptionUtils.java (added)
+++ tomcat/trunk/java/org/apache/jasper/util/ExceptionUtils.java Sat Apr 24 19:26:17 2010
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jasper.util;
+
+/**
+ * Utilities for handling Throwables and Exceptions.
+ */
+public class ExceptionUtils {
+    
+    /**
+     * Checks whether the supplied Throwable is one that needs to be 
+     * rethrown and swallows all others.
+     * @param t the Throwable to check
+     */
+    public static void handleThrowable(Throwable t) {
+        if (t instanceof ThreadDeath) {
+            throw (ThreadDeath) t;
+        }
+        if (t instanceof VirtualMachineError) {
+            throw (VirtualMachineError) t;
+        }
+        // All other instances of Throwable will be silently swallowed
+    }
+}

Propchange: tomcat/trunk/java/org/apache/jasper/util/ExceptionUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tomcat/trunk/java/org/apache/tomcat/util/ExceptionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/ExceptionUtils.java?rev=937680&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/ExceptionUtils.java (added)
+++ tomcat/trunk/java/org/apache/tomcat/util/ExceptionUtils.java Sat Apr 24 19:26:17 2010
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomcat.util;
+
+/**
+ * Utilities for handling Throwables and Exceptions.
+ */
+public class ExceptionUtils {
+    
+    /**
+     * Checks whether the supplied Throwable is one that needs to be 
+     * rethrown and swallows all others.
+     * @param t the Throwable to check
+     */
+    public static void handleThrowable(Throwable t) {
+        if (t instanceof ThreadDeath) {
+            throw (ThreadDeath) t;
+        }
+        if (t instanceof VirtualMachineError) {
+            throw (VirtualMachineError) t;
+        }
+        // All other instances of Throwable will be silently swallowed
+    }
+}

Propchange: tomcat/trunk/java/org/apache/tomcat/util/ExceptionUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native



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


Mime
View raw message