Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8825E200B49 for ; Wed, 3 Aug 2016 11:40:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 86A0C160A86; Wed, 3 Aug 2016 09:40:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CD077160A64 for ; Wed, 3 Aug 2016 11:40:18 +0200 (CEST) Received: (qmail 35430 invoked by uid 500); 3 Aug 2016 09:40:17 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 35420 invoked by uid 99); 3 Aug 2016 09:40:17 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2016 09:40:17 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 47A311858D4 for ; Wed, 3 Aug 2016 09:40:17 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.374 X-Spam-Level: X-Spam-Status: No, score=0.374 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id UdqMguFI0css for ; Wed, 3 Aug 2016 09:40:16 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 878245FD67 for ; Wed, 3 Aug 2016 09:40:14 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id E4CEAE05CC for ; Wed, 3 Aug 2016 09:40:13 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id DF8DB3A1A11 for ; Wed, 3 Aug 2016 09:40:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1755059 - in /tomcat/tc8.0.x/trunk: modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java webapps/docs/changelog.xml Date: Wed, 03 Aug 2016 09:40:13 -0000 To: dev@tomcat.apache.org From: kfujino@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160803094013.DF8DB3A1A11@svn01-us-west.apache.org> archived-at: Wed, 03 Aug 2016 09:40:19 -0000 Author: kfujino Date: Wed Aug 3 09:40:13 2016 New Revision: 1755059 URL: http://svn.apache.org/viewvc?rev=1755059&view=rev Log: Ensure that the ResultSet is returned as Proxy object when enabling the StatementDecoratorInterceptor. Modified: tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java?rev=1755059&r1=1755058&r2=1755059&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java (original) +++ tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementDecoratorInterceptor.java Wed Aug 3 09:40:13 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. */ @@ -236,7 +244,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; @@ -256,7 +265,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/tc8.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1755059&r1=1755058&r2=1755059&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Wed Aug 3 09:40:13 2016 @@ -240,6 +240,10 @@ that continues to return an invalid connection after database restart. (kfujino) + + Ensure that the ResultSet is returned as Proxy object when + enabling the StatementDecoratorInterceptor. (kfujino) + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org