tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1201555 - in /tomcat/trunk/java/org/apache/catalina: core/ deploy/ loader/ manager/ manager/util/ security/ startup/
Date Mon, 14 Nov 2011 00:08:50 GMT
Author: kkolinko
Date: Mon Nov 14 00:08:49 2011
New Revision: 1201555

URL: http://svn.apache.org/viewvc?rev=1201555&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/JreMemoryLeakPreventionListener.java
    tomcat/trunk/java/org/apache/catalina/deploy/NamingResources.java
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
    tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java
    tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java
    tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java
    tomcat/trunk/java/org/apache/catalina/security/SecurityUtil.java
    tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java
    tomcat/trunk/java/org/apache/catalina/startup/Tool.java

Modified: tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?rev=1201555&r1=1201554&r2=1201555&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java Mon Nov
14 00:08:49 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/trunk/java/org/apache/catalina/deploy/NamingResources.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/NamingResources.java?rev=1201555&r1=1201554&r2=1201555&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/NamingResources.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/NamingResources.java Mon Nov 14 00:08:49
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;
 
 
@@ -1022,8 +1023,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/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1201555&r1=1201554&r2=1201555&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Mon Nov 14 00:08:49
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/trunk/java/org/apache/catalina/loader/WebappLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java?rev=1201555&r1=1201554&r2=1201555&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java Mon Nov 14 00:08:49 2011
@@ -1066,6 +1066,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/trunk/java/org/apache/catalina/manager/StatusTransformer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java?rev=1201555&r1=1201554&r2=1201555&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/StatusTransformer.java Mon Nov 14 00:08:49
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/trunk/java/org/apache/catalina/manager/util/SessionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java?rev=1201555&r1=1201554&r2=1201555&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java Mon Nov 14 00:08:49
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/trunk/java/org/apache/catalina/security/SecurityUtil.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/security/SecurityUtil.java?rev=1201555&r1=1201554&r2=1201555&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/security/SecurityUtil.java (original)
+++ tomcat/trunk/java/org/apache/catalina/security/SecurityUtil.java Mon Nov 14 00:08:49 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/trunk/java/org/apache/catalina/startup/Bootstrap.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java?rev=1201555&r1=1201554&r2=1201555&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java Mon Nov 14 00:08:49 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/trunk/java/org/apache/catalina/startup/Tool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Tool.java?rev=1201555&r1=1201554&r2=1201555&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Tool.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Tool.java Mon Nov 14 00:08:49 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


Mime
View raw message