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 01:44:08 UTC

svn commit: r1201562 - in /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor: AbstractQueryReport.java StatementDecoratorInterceptor.java

Author: kkolinko
Date: Mon Nov 14 00:44:07 2011
New Revision: 1201562

URL: http://svn.apache.org/viewvc?rev=1201562&view=rev
Log:
Unwrap InvocationTargetException if it is caught in ResultSetProxy,
like we do it elsewhere.

Modified:
    tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java
    tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java

Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java?rev=1201562&r1=1201561&r2=1201562&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java Mon Nov 14 00:44:07 2011
@@ -235,8 +235,9 @@ public abstract class AbstractQueryRepor
                 result =  method.invoke(delegate,args);
             }catch (Throwable t) {
                 reportFailedQuery(query,args,name,start,t);
-                if (t instanceof InvocationTargetException) {
-                    throw t.getCause() != null ? t.getCause() : t;
+                if (t instanceof InvocationTargetException
+                        && t.getCause() != null) {
+                    throw t.getCause();
                 } else {
                     throw t;
                 }

Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java?rev=1201562&r1=1201561&r2=1201562&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java Mon Nov 14 00:44:07 2011
@@ -240,8 +240,9 @@ public class StatementDecoratorIntercept
                     result = method.invoke(delegate, args);
                 }
             } catch (Throwable t) {
-                if (t instanceof InvocationTargetException) {
-                    throw t.getCause() != null ? t.getCause() : t;
+                if (t instanceof InvocationTargetException
+                        && t.getCause() != null) {
+                    throw t.getCause();
                 } else {
                     throw t;
                 }
@@ -284,7 +285,16 @@ public class StatementDecoratorIntercept
             if (method.getName().equals("getStatement")) {
                 return this.st;
             } else {
-                return method.invoke(this.delegate, args);
+                try {
+                    return method.invoke(this.delegate, args);
+                } catch (Throwable t) {
+                    if (t instanceof InvocationTargetException
+                            && t.getCause() != null) {
+                        throw t.getCause();
+                    } else {
+                        throw t;
+                    }
+                }
             }
         }
     }



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