You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2011/11/14 02:36:08 UTC

svn commit: r1201569 - in /tomcat/tc7.0.x/trunk/java: javax/el/ org/apache/catalina/core/ org/apache/catalina/deploy/ org/apache/catalina/loader/ org/apache/catalina/manager/ org/apache/catalina/manager/util/ org/apache/catalina/security/ org/apache/ca...

Author: kkolinko
Date: Mon Nov 14 01:36:07 2011
New Revision: 1201569

URL: http://svn.apache.org/viewvc?rev=1201569&view=rev
Log:
Merging revisions r1201521 r1201542 r1201545 r1201546 r1201548 r1201555 r1201556 r1201568 from tomcat/trunk:
Improve processing of errors that are wrapped into InvocationTargetException.
Rethrow errors that must be rethrown.
Part 1 of 2.

Modified:
    tomcat/tc7.0.x/trunk/java/javax/el/BeanELResolver.java
    tomcat/tc7.0.x/trunk/java/javax/el/ExpressionFactory.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappLoader.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/StatusTransformer.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/util/SessionUtils.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/security/SecurityUtil.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Bootstrap.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tool.java

Modified: tomcat/tc7.0.x/trunk/java/javax/el/BeanELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/javax/el/BeanELResolver.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/javax/el/BeanELResolver.java (original)
+++ tomcat/tc7.0.x/trunk/java/javax/el/BeanELResolver.java Mon Nov 14 01:36:07 2011
@@ -88,9 +88,16 @@ public class BeanELResolver extends ELRe
         } catch (IllegalAccessException e) {
             throw new ELException(e);
         } catch (InvocationTargetException e) {
+            Throwable cause = e.getCause();
+            if (cause instanceof ThreadDeath) {
+                throw (ThreadDeath) cause;
+            }
+            if (cause instanceof VirtualMachineError) {
+                throw (VirtualMachineError) cause;
+            }
             throw new ELException(message(context, "propertyReadError",
                     new Object[] { base.getClass().getName(),
-                            property.toString() }), e.getCause());
+                            property.toString() }), cause);
         } catch (Exception e) {
             throw new ELException(e);
         }
@@ -136,9 +143,16 @@ public class BeanELResolver extends ELRe
         } catch (IllegalAccessException e) {
             throw new ELException(e);
         } catch (InvocationTargetException e) {
+            Throwable cause = e.getCause();
+            if (cause instanceof ThreadDeath) {
+                throw (ThreadDeath) cause;
+            }
+            if (cause instanceof VirtualMachineError) {
+                throw (VirtualMachineError) cause;
+            }
             throw new ELException(message(context, "propertyWriteError",
                     new Object[] { base.getClass().getName(),
-                            property.toString() }), e.getCause());
+                            property.toString() }), cause);
         } catch (Exception e) {
             throw new ELException(e);
         }
@@ -473,7 +487,14 @@ public class BeanELResolver extends ELRe
         } catch (IllegalAccessException e) {
             throw new ELException(e);
         } catch (InvocationTargetException e) {
-            throw new ELException(e.getCause());
+            Throwable cause = e.getCause();
+            if (cause instanceof ThreadDeath) {
+                throw (ThreadDeath) cause;
+            }
+            if (cause instanceof VirtualMachineError) {
+                throw (VirtualMachineError) cause;
+            }
+            throw new ELException(cause);
         }
         
         context.setPropertyResolved(true);

Modified: tomcat/tc7.0.x/trunk/java/javax/el/ExpressionFactory.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/javax/el/ExpressionFactory.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/javax/el/ExpressionFactory.java (original)
+++ tomcat/tc7.0.x/trunk/java/javax/el/ExpressionFactory.java Mon Nov 14 01:36:07 2011
@@ -200,6 +200,13 @@ public abstract class ExpressionFactory 
                     "Unable to create ExpressionFactory of type: " + className,
                     e);
         } catch (InvocationTargetException e) {
+            Throwable cause = e.getCause();
+            if (cause instanceof ThreadDeath) {
+                throw (ThreadDeath) cause;
+            }
+            if (cause instanceof VirtualMachineError) {
+                throw (VirtualMachineError) cause;
+            }
             throw new ELException(
                     "Unable to create ExpressionFactory of type: " + className,
                     e);

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java Mon Nov 14 01:36:07 2011
@@ -997,6 +997,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);
@@ -1142,6 +1143,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);
@@ -1301,6 +1303,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);
@@ -1387,6 +1390,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/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java Mon Nov 14 01:36:07 2011
@@ -191,6 +191,7 @@ public class ApplicationContextFacade im
                 return (URL) invokeMethod(context, "getResource", 
                                           new Object[]{path});
             } catch(Throwable t) {
+                ExceptionUtils.handleThrowable(t);
                 if (t instanceof MalformedURLException){
                     throw (MalformedURLException)t;
                 }
@@ -765,6 +766,7 @@ public class ApplicationContextFacade im
         try{
             return invokeMethod(context, methodName, params);
         }catch(Throwable t){
+            ExceptionUtils.handleThrowable(t);
             throw new RuntimeException(t.getMessage(), t);
         }
     }
@@ -870,8 +872,10 @@ public class ApplicationContextFacade im
         }
         
         if (ex instanceof InvocationTargetException) {
-            realException =
-                ((InvocationTargetException) ex).getTargetException();
+            realException = ex.getCause();
+            if (realException == null) {
+                realException = ex;
+            }
         } else {
             realException = ex;
         }   

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java Mon Nov 14 01:36:07 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/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java Mon Nov 14 01:36:07 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/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java Mon Nov 14 01:36:07 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/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java Mon Nov 14 01:36:07 2011
@@ -108,6 +108,7 @@ public class AprLifecycleListener
                     try {
                         initializeSSL();
                     } catch (Throwable t) {
+                        t = ExceptionUtils.unwrapInvocationTargetException(t);
                         ExceptionUtils.handleThrowable(t);
                         log.error(sm.getString("aprListener.sslInit"), t);
                     }
@@ -129,6 +130,7 @@ public class AprLifecycleListener
                 try {
                     terminateAPR();
                 } catch (Throwable t) {
+                    t = ExceptionUtils.unwrapInvocationTargetException(t);
                     ExceptionUtils.handleThrowable(t);
                     log.info(sm.getString("aprListener.aprDestroy"));
                 }
@@ -180,6 +182,7 @@ public class AprLifecycleListener
             patch = clazz.getField("TCN_PATCH_VERSION").getInt(null);
             apver = major * 1000 + minor * 100 + patch;
         } catch (Throwable t) {
+            t = ExceptionUtils.unwrapInvocationTargetException(t);
             ExceptionUtils.handleThrowable(t);
             log.info(sm.getString("aprListener.aprInit",
                     System.getProperty("java.library.path")));
@@ -196,6 +199,7 @@ public class AprLifecycleListener
                 // is below required.
                 terminateAPR();
             } catch (Throwable t) {
+                t = ExceptionUtils.unwrapInvocationTargetException(t);
                 ExceptionUtils.handleThrowable(t);
             }
             return;

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Mon Nov 14 01:36:07 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/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java Mon Nov 14 01:36:07 2011
@@ -35,6 +35,7 @@ import org.apache.catalina.LifecycleEven
 import org.apache.catalina.LifecycleListener;
 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;
 
 /**
@@ -314,6 +315,7 @@ public class JreMemoryLeakPreventionList
                         log.error(sm.getString("jreLeakListener.gcDaemonFail"),
                                 e);
                     } catch (InvocationTargetException e) {
+                        ExceptionUtils.handleThrowable(e.getCause());
                         log.error(sm.getString("jreLeakListener.gcDaemonFail"),
                                 e);
                     }
@@ -345,6 +347,7 @@ public class JreMemoryLeakPreventionList
                         log.warn(sm.getString("jreLeakListener.authPolicyFail"),
                                 e);
                     } catch (InvocationTargetException e) {
+                        ExceptionUtils.handleThrowable(e.getCause());
                         log.warn(sm.getString("jreLeakListener.authPolicyFail"),
                                 e);
                     }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java Mon Nov 14 01:36:07 2011
@@ -4625,6 +4625,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);
@@ -4699,6 +4700,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",
@@ -4814,6 +4816,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",
@@ -4833,6 +4836,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/tc7.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java Mon Nov 14 01:36:07 2011
@@ -1140,6 +1140,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);
 
@@ -1472,6 +1473,7 @@ public class StandardWrapper extends Con
                 }
     
             } catch (Throwable t) {
+                t = ExceptionUtils.unwrapInvocationTargetException(t);
                 ExceptionUtils.handleThrowable(t);
                 instanceSupport.fireInstanceEvent
                   (InstanceEvent.AFTER_DESTROY_EVENT, instance, t);
@@ -1521,6 +1523,7 @@ public class StandardWrapper extends Con
                     }
                 }
             } catch (Throwable t) {
+                t = ExceptionUtils.unwrapInvocationTargetException(t);
                 ExceptionUtils.handleThrowable(t);
                 instancePool = null;
                 nInstances = 0;

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java Mon Nov 14 01:36:07 2011
@@ -40,6 +40,7 @@ import org.apache.catalina.util.Lifecycl
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.naming.ContextBindings;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
 
@@ -1033,8 +1034,10 @@ public class NamingResources extends Lif
                 log.warn(sm.getString("namingResources.cleanupCloseFailed",
                         closeMethod, name, container), e);
             } catch (InvocationTargetException e) {
+                Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
+                ExceptionUtils.handleThrowable(t);
                 log.warn(sm.getString("namingResources.cleanupCloseFailed",
-                        closeMethod, name, container), e);
+                        closeMethod, name, container), t);
             }
         }
     }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Mon Nov 14 01:36:07 2011
@@ -27,7 +27,6 @@ import java.io.InputStream;
 import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.net.MalformedURLException;
@@ -2039,8 +2038,10 @@ public class WebappClassLoader
             }
         } catch (Exception e) {
             // So many things to go wrong above...
+            Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
+            ExceptionUtils.handleThrowable(t);
             log.warn(sm.getString(
-                    "webappClassLoader.jdbcRemoveFailed", contextName), e);
+                    "webappClassLoader.jdbcRemoveFailed", contextName), t);
         } finally {
             if (is != null) {
                 try {
@@ -2345,22 +2346,13 @@ public class WebappClassLoader
             log.error(sm.getString("webappClassLoader.warnTimerThread",
                     contextName, thread.getName()));
 
-        } catch (NoSuchFieldException e) {
-            log.warn(sm.getString(
-                    "webappClassLoader.stopTimerThreadFail",
-                    thread.getName(), contextName), e);
-        } catch (IllegalAccessException e) {
-            log.warn(sm.getString(
-                    "webappClassLoader.stopTimerThreadFail",
-                    thread.getName(), contextName), e);
-        } catch (NoSuchMethodException e) {
-            log.warn(sm.getString(
-                    "webappClassLoader.stopTimerThreadFail",
-                    thread.getName(), contextName), e);
-        } catch (InvocationTargetException e) {
+        } catch (Exception e) {
+            // So many things to go wrong above...
+            Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
+            ExceptionUtils.handleThrowable(t);
             log.warn(sm.getString(
                     "webappClassLoader.stopTimerThreadFail",
-                    thread.getName(), contextName), e);
+                    thread.getName(), contextName), t);
         }
     }
 

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappLoader.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappLoader.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappLoader.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappLoader.java Mon Nov 14 01:36:07 2011
@@ -1096,6 +1096,8 @@ public class WebappLoader extends Lifecy
                 return (String)o;
             return null;
         } catch( Exception ex ) {
+            Throwable t = ExceptionUtils.unwrapInvocationTargetException(ex);
+            ExceptionUtils.handleThrowable(t);
             if (log.isDebugEnabled())
                 log.debug("getClasspath ", ex);
         }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/StatusTransformer.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/StatusTransformer.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/StatusTransformer.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/StatusTransformer.java Mon Nov 14 01:36:07 2011
@@ -160,6 +160,7 @@ public class StatusTransformer {
             method.invoke(null, paramValues);
             ok = true;
         } catch (Throwable t) {
+            t = ExceptionUtils.unwrapInvocationTargetException(t);
             ExceptionUtils.handleThrowable(t);
         }
         

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/util/SessionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/util/SessionUtils.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/util/SessionUtils.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/manager/util/SessionUtils.java Mon Nov 14 01:36:07 2011
@@ -28,6 +28,7 @@ import javax.security.auth.Subject;
 import javax.servlet.http.HttpSession;
 
 import org.apache.catalina.Session;
+import org.apache.tomcat.util.ExceptionUtils;
 
 /**
  * Utility methods on HttpSessions...
@@ -130,6 +131,9 @@ public class SessionUtils {
                                 }
                             }
                         } catch (Exception e) {
+                            Throwable t = ExceptionUtils
+                                    .unwrapInvocationTargetException(e);
+                            ExceptionUtils.handleThrowable(t);
                             // stay silent
                         }
                     }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/security/SecurityUtil.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/security/SecurityUtil.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/security/SecurityUtil.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/security/SecurityUtil.java Mon Nov 14 01:36:07 2011
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpSession;
 
 import org.apache.catalina.Globals;
+import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 /**
  * This utility class associates a <code>Subject</code> to the current
@@ -306,8 +307,8 @@ public final class SecurityUtil{
         } catch( PrivilegedActionException pe) {
             Throwable e;
             if (pe.getException() instanceof InvocationTargetException) {
-                e = ((InvocationTargetException)pe.getException())
-                                .getTargetException();
+                e = pe.getException().getCause();
+                ExceptionUtils.handleThrowable(e);
             } else {
                 e = pe;
             }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Bootstrap.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Bootstrap.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Bootstrap.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Bootstrap.java Mon Nov 14 01:36:07 2011
@@ -460,12 +460,12 @@ public final class Bootstrap {
                 log.warn("Bootstrap: command \"" + command + "\" does not exist.");
             }
         } catch (Throwable t) {
-            handleThrowable(t);
             // Unwrap the Exception for clearer error reporting
             if (t instanceof InvocationTargetException &&
                     t.getCause() != null) {
                 t = t.getCause();
             }
+            handleThrowable(t);
             t.printStackTrace();
             System.exit(1);
         }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tool.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tool.java?rev=1201569&r1=1201568&r2=1201569&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tool.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/Tool.java Mon Nov 14 01:36:07 2011
@@ -229,6 +229,7 @@ public final class Tool {
             paramValues[0] = params;
             method.invoke(null, paramValues);
         } catch (Throwable t) {
+            t = ExceptionUtils.unwrapInvocationTargetException(t);
             ExceptionUtils.handleThrowable(t);
             log.error("Exception calling main() method", t);
             System.exit(1);



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