Author: kfujino
Date: Wed Aug 3 09:42:16 2016
New Revision: 1755060
URL: http://svn.apache.org/viewvc?rev=1755060&view=rev
Log:
Ensure that the ResultSet is returned as Proxy object when enabling the
StatementDecoratorInterceptor.
Modified:
tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Modified:
tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java?rev=1755060&r1=1755059&r2=1755060&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
(original)
+++
tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
Wed Aug 3 09:42:16 2016
@@ -40,7 +40,11 @@ public class StatementDecoratorIntercept
private static final Log logger =
LogFactory.getLog(StatementDecoratorInterceptor.class);
- private static final String[] EXECUTE_QUERY_TYPES = { "executeQuery" };
+ protected static final String EXECUTE_QUERY = "executeQuery";
+ protected static final String GETGENERATEDKEYS = "getGeneratedKeys";
+ protected static final String GET_RESULTSET = "getResultSet";
+
+ protected static final String[] RESULTSET_TYPES = {EXECUTE_QUERY,
GETGENERATEDKEYS, GET_RESULTSET};
/**
* the constructors that are used to create statement proxies
@@ -154,13 +158,17 @@ public class StatementDecoratorIntercept
}
protected boolean isExecuteQuery(String methodName) {
- return EXECUTE_QUERY_TYPES[0].equals(methodName);
+ return EXECUTE_QUERY.equals(methodName);
}
protected boolean isExecuteQuery(Method method) {
return isExecuteQuery(method.getName());
}
+ protected boolean isResultSet(Method method, boolean process) {
+ return process(RESULTSET_TYPES, method, process);
+ }
+
/**
* Class to measure query execute time
*
@@ -239,7 +247,8 @@ public class StatementDecoratorIntercept
if (compare(GETCONNECTION_VAL,method)){
return connection;
}
- boolean process = isExecuteQuery(method);
+ boolean process = false;
+ process = isResultSet(method, process);
// check to see if we are about to execute a query
// if we are executing, get the current time
Object result = null;
@@ -259,7 +268,7 @@ public class StatementDecoratorIntercept
throw t;
}
}
- if (process){
+ if (process && result != null) {
Constructor<?> cons = getResultSetConstructor();
result = cons.newInstance(new Object[]{new
ResultSetProxy(actualProxy, result)});
}
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1755060&r1=1755059&r2=1755060&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Aug 3 09:42:16 2016
@@ -216,6 +216,10 @@
that continues to return an invalid connection after database restart.
(kfujino)
</fix>
+ <fix>
+ Ensure that the <code>ResultSet</code> is returned as Proxy object when
+ enabling the <code>StatementDecoratorInterceptor</code>. (kfujino)
+ </fix>
</changelog>
</subsection>
<subsection name="Other">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]