tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1201493 - in /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc: naming/GenericNamingResourcesFactory.java pool/TrapException.java
Date Sun, 13 Nov 2011 19:50:48 GMT
Author: kkolinko
Date: Sun Nov 13 19:50:48 2011
New Revision: 1201493

URL: http://svn.apache.org/viewvc?rev=1201493&view=rev
Log:
Improve processing of errors that are wrapped into InvocationTargetException.
TrapException interceptor: Rethrow them as an Error. Do not wrap them into RuntimeException.

Modified:
    tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
    tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/TrapException.java

Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java?rev=1201493&r1=1201492&r2=1201493&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
Sun Nov 13 19:50:48 2011
@@ -200,6 +200,13 @@ public class GenericNamingResourcesFacto
                 log.debug("IntrospectionUtils: IllegalAccessException for " +
                         o.getClass() + " " + name + "=" + value + ")", iae);
         } catch (InvocationTargetException ie) {
+            Throwable cause = ie.getCause();
+            if (cause instanceof ThreadDeath) {
+                throw (ThreadDeath) cause;
+            }
+            if (cause instanceof VirtualMachineError) {
+                throw (VirtualMachineError) cause;
+            }
             if (log.isDebugEnabled())
                 log.debug("IntrospectionUtils: InvocationTargetException for " +
                         o.getClass() + " " + name + "=" + value + ")", ie);

Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/TrapException.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/TrapException.java?rev=1201493&r1=1201492&r2=1201493&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/TrapException.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/TrapException.java
Sun Nov 13 19:50:48 2011
@@ -41,8 +41,11 @@ public class TrapException extends JdbcI
             return super.invoke(proxy, method, args);
         }catch (Exception t) {
             Throwable exception = t;
-            if (t instanceof InvocationTargetException) {
-                exception = t.getCause() != null ? t.getCause() : t;
+            if (t instanceof InvocationTargetException && t.getCause() != null) {
+                exception = t.getCause();
+                if (exception instanceof Error) {
+                    throw exception;
+                }
             }
             Class<?> exceptionClass = exception.getClass();
             if (!isDeclaredException(method, exceptionClass)) {



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


Mime
View raw message