Am 3. August 2016 11:36:34 MESZ, schrieb [email protected]:
>Author: kfujino
>Date: Wed Aug 3 09:36:34 2016
>New Revision: 1755056
>
>URL: http://svn.apache.org/viewvc?rev=1755056&view=rev
>Log:
>Ensure that the ResultSet is returned as Proxy object when enabling the
>StatementDecoratorInterceptor.
>
>Modified:
>tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java
> tomcat/trunk/webapps/docs/changelog.xml
>
>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=1755056&r1=1755055&r2=1755056&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
>Wed Aug 3 09:36:34 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";
Shouldn't this be GET_GENERATED_KEYS?
Regards,
Felix
>+ 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
>@@ -157,13 +161,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/trunk/webapps/docs/changelog.xml
>URL:
>http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1755056&r1=1755055&r2=1755056&view=diff
>==============================================================================
>--- tomcat/trunk/webapps/docs/changelog.xml (original)
>+++ tomcat/trunk/webapps/docs/changelog.xml Wed Aug 3 09:36:34 2016
>@@ -157,6 +157,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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]