tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1201545 - in /tomcat/trunk/java/org/apache/catalina/core: ApplicationContext.java ApplicationFilterChain.java ApplicationFilterConfig.java ApplicationFilterFactory.java AsyncContextImpl.java StandardContext.java StandardWrapper.java
Date Sun, 13 Nov 2011 23:34:31 GMT
Author: kkolinko
Date: Sun Nov 13 23:34:30 2011
New Revision: 1201545

URL: http://svn.apache.org/viewvc?rev=1201545&view=rev
Log:
Improve processing of errors that are wrapped into InvocationTargetException.
Rethrow errors that must be rethrown.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
    tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
    tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
    tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
    tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1201545&r1=1201544&r2=1201545&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Sun Nov 13 23:34:30
2011
@@ -981,6 +981,7 @@ public class ApplicationContext
         } catch (IllegalAccessException e) {
             throw new ServletException(e);
         } catch (InvocationTargetException e) {
+            ExceptionUtils.handleThrowable(e.getCause());
             throw new ServletException(e);
         } catch (NamingException e) {
             throw new ServletException(e);
@@ -1126,6 +1127,7 @@ public class ApplicationContext
         } catch (IllegalAccessException e) {
             throw new ServletException(e);
         } catch (InvocationTargetException e) {
+            ExceptionUtils.handleThrowable(e.getCause());
             throw new ServletException(e);
         } catch (NamingException e) {
             throw new ServletException(e);
@@ -1285,6 +1287,7 @@ public class ApplicationContext
                     "applicationContext.addListener.iae.cnfe", className),
                     e);
         } catch (InvocationTargetException e) {
+            ExceptionUtils.handleThrowable(e.getCause());
             throw new IllegalArgumentException(sm.getString(
                     "applicationContext.addListener.iae.cnfe", className),
                     e);
@@ -1371,6 +1374,7 @@ public class ApplicationContext
         } catch (IllegalAccessException e) {
             throw new ServletException(e);
         } catch (InvocationTargetException e) {
+            ExceptionUtils.handleThrowable(e.getCause());
             throw new ServletException(e);
         } catch (NamingException e) {
             throw new ServletException(e);

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java?rev=1201545&r1=1201544&r2=1201545&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java Sun Nov 13 23:34:30
2011
@@ -261,6 +261,7 @@ final class ApplicationFilterChain imple
                                               filter, request, response, e);
                 throw e;
             } catch (Throwable e) {
+                e = ExceptionUtils.unwrapInvocationTargetException(e);
                 ExceptionUtils.handleThrowable(e);
                 if (filter != null)
                     support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
@@ -452,6 +453,7 @@ final class ApplicationFilterChain imple
                             */
                 throw e;
             } catch (Throwable e) {
+                e = ExceptionUtils.unwrapInvocationTargetException(e);
                 ExceptionUtils.handleThrowable(e);
                 /*if (filter != null)
                     support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java?rev=1201545&r1=1201544&r2=1201545&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java Sun Nov 13 23:34:30
2011
@@ -40,6 +40,7 @@ import org.apache.catalina.deploy.Filter
 import org.apache.catalina.security.SecurityUtil;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.InstanceManager;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.log.SystemLogHandler;
 import org.apache.tomcat.util.modeler.Registry;
 import org.apache.tomcat.util.res.StringManager;
@@ -313,7 +314,10 @@ public final class ApplicationFilterConf
                 try {
                     ((StandardContext) context).getInstanceManager().destroyInstance(this.filter);
                 } catch (Exception e) {
-                    context.getLogger().error("ApplicationFilterConfig.preDestroy", e);
+                    Throwable t = ExceptionUtils
+                            .unwrapInvocationTargetException(e);
+                    ExceptionUtils.handleThrowable(t);
+                    context.getLogger().error("ApplicationFilterConfig.preDestroy", t);
                 }
             }
         }
@@ -363,7 +367,10 @@ public final class ApplicationFilterConf
                     try {
                         ((StandardContext) context).getInstanceManager().destroyInstance(this.filter);
                     } catch (Exception e) {
-                        context.getLogger().error("ApplicationFilterConfig.preDestroy", e);
+                        Throwable t = ExceptionUtils
+                                .unwrapInvocationTargetException(e);
+                        ExceptionUtils.handleThrowable(t);
+                        context.getLogger().error("ApplicationFilterConfig.preDestroy", t);
                     }
                 }
             }

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java?rev=1201545&r1=1201544&r2=1201545&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java Sun Nov 13 23:34:30
2011
@@ -28,6 +28,7 @@ import org.apache.catalina.Wrapper;
 import org.apache.catalina.comet.CometFilter;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.deploy.FilterMap;
+import org.apache.tomcat.util.ExceptionUtils;
 
 /**
  * Factory for the creation and caching of Filters and creation
@@ -162,6 +163,8 @@ public final class ApplicationFilterFact
                     // Note: The try catch is there because getFilter has a lot of
                     // declared exceptions. However, the filter is allocated much
                     // earlier
+                    Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
+                    ExceptionUtils.handleThrowable(t);
                 }
                 if (isCometFilter) {
                     filterChain.addFilter(filterConfig);

Modified: tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1201545&r1=1201544&r2=1201545&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Sun Nov 13 23:34:30 2011
@@ -48,6 +48,7 @@ import org.apache.coyote.RequestInfo;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.InstanceManager;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 /**
  *
@@ -239,6 +240,7 @@ public class AsyncContextImpl implements
             ServletException se = new ServletException(e);
             throw se;
         } catch (InvocationTargetException e) {
+            ExceptionUtils.handleThrowable(e.getCause());
             ServletException se = new ServletException(e);
             throw se;
         } catch (NamingException e) {

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1201545&r1=1201544&r2=1201545&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Sun Nov 13 23:34:30 2011
@@ -4519,6 +4519,7 @@ public class StandardContext extends Con
                         new ApplicationFilterConfig(this, filterDefs.get(name));
                     filterConfigs.put(name, filterConfig);
                 } catch (Throwable t) {
+                    t = ExceptionUtils.unwrapInvocationTargetException(t);
                     ExceptionUtils.handleThrowable(t);
                     getLogger().error
                         (sm.getString("standardContext.filterStart", name), t);
@@ -4593,6 +4594,7 @@ public class StandardContext extends Con
             try {
                 results[i] = instanceManager.newInstance(listeners[i]);
             } catch (Throwable t) {
+                t = ExceptionUtils.unwrapInvocationTargetException(t);
                 ExceptionUtils.handleThrowable(t);
                 getLogger().error
                     (sm.getString("standardContext.applicationListener",
@@ -4708,6 +4710,7 @@ public class StandardContext extends Con
                 try {
                     getInstanceManager().destroyInstance(listeners[j]);
                 } catch (Throwable t) {
+                    t = ExceptionUtils.unwrapInvocationTargetException(t);
                     ExceptionUtils.handleThrowable(t);
                     getLogger().error
                        (sm.getString("standardContext.listenerStop",
@@ -4727,6 +4730,7 @@ public class StandardContext extends Con
                 try {
                     getInstanceManager().destroyInstance(listeners[j]);
                 } catch (Throwable t) {
+                    t = ExceptionUtils.unwrapInvocationTargetException(t);
                     ExceptionUtils.handleThrowable(t);
                     getLogger().error
                         (sm.getString("standardContext.listenerStop",

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=1201545&r1=1201544&r2=1201545&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java Sun Nov 13 23:34:30 2011
@@ -1098,6 +1098,7 @@ public class StandardWrapper extends Con
                 throw new ServletException
                     (sm.getString("standardWrapper.notServlet", servletClass), e);
             } catch (Throwable e) {
+                e = ExceptionUtils.unwrapInvocationTargetException(e);
                 ExceptionUtils.handleThrowable(e);
                 unavailable(null);
 
@@ -1430,6 +1431,7 @@ public class StandardWrapper extends Con
                 }
 
             } catch (Throwable t) {
+                t = ExceptionUtils.unwrapInvocationTargetException(t);
                 ExceptionUtils.handleThrowable(t);
                 instanceSupport.fireInstanceEvent
                   (InstanceEvent.AFTER_DESTROY_EVENT, instance, t);
@@ -1479,6 +1481,7 @@ public class StandardWrapper extends Con
                     }
                 }
             } catch (Throwable t) {
+                t = ExceptionUtils.unwrapInvocationTargetException(t);
                 ExceptionUtils.handleThrowable(t);
                 instancePool = null;
                 nInstances = 0;



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


Mime
View raw message