Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 11591 invoked from network); 21 Jun 2009 16:44:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Jun 2009 16:44:21 -0000 Received: (qmail 50585 invoked by uid 500); 21 Jun 2009 16:44:32 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 50487 invoked by uid 500); 21 Jun 2009 16:44:31 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 50477 invoked by uid 99); 21 Jun 2009 16:44:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Jun 2009 16:44:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Jun 2009 16:44:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 57117234C004 for ; Sun, 21 Jun 2009 09:44:07 -0700 (PDT) Message-ID: <835857921.1245602647342.JavaMail.jira@brutus> Date: Sun, 21 Jun 2009 09:44:07 -0700 (PDT) From: "Mark Thomas (JIRA)" To: issues@commons.apache.org Subject: [jira] Resolved: (DBCP-288) DelegatingConnection implicitly casts AbandonedTrace to Statement In-Reply-To: <805429858.1240220330574.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DBCP-288?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Mark Thomas resolved DBCP-288. ------------------------------ Resolution: Fixed Many thanks for the patch. I have applied it (with some minor modifications= ) to trunk and it will be included in 1.3 onwards. > DelegatingConnection implicitly casts AbandonedTrace to Statement > ----------------------------------------------------------------- > > Key: DBCP-288 > URL: https://issues.apache.org/jira/browse/DBCP-288 > Project: Commons Dbcp > Issue Type: Bug > Affects Versions: 1.3 > Environment: I am using DBCP from svn-trunk (rev 766626). > I am using the BasicManagedDatasource with the MysqlXADataSource. > Configuration of BasicDataSource:=20 > maxActive=3D"10" > maxIdle=3D"10" > maxWait=3D"5000" > minIdle=3D"0" > initialSize=3D"2" > removeAbandoned=3D"true" > removeAbandonedTimeout=3D"120" > logAbandoned=3D"true" > Reporter: Marc Kannegie=C3=9Fer > Fix For: 1.3 > > Attachments: delegating_connection_close_statements.patch > > > If a {{ManagedConnection}} is put back to the connection pool it gets pas= sivated ({{GenericObjectPool line 1101}}) by calling {{passivateObject()}} = on the {{PoolableConnectionFactory}} which calls passivate() on the {{Deleg= atingConnection}}. > {{passivate()}} in {{DelegatingConnection}} then executes the following c= ode:=20 > {code:java}=20 > List statements =3D getTrace(); > if( statements !=3D null) { > Statement[] set =3D new Statement[statements.size()]; > statements.toArray(set); > for (int i =3D 0; i < set.length; i++) { > set[i].close(); > } > clearTrace(); > } > {code} > This is an implicit cast from {{AbandonedTrace}} to {{Statement}} since {= {getTrace()}} returns a list of {{AbandonedTrace}} instances.=20 > If the list contains other instances than those, that implement Statement= an ArrayStoreException is thrown at {{statements.toArray(set)}} (line 416)= . See http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html#toAr= ray() for details.=20 > I'd say this is a bug since {{AbandonedTrace}} does not implement {{State= ment}} and there are derived classes that do not implement it also.=20 > In my case the list returned by {{getTrace()}} contains instances of {{De= legatingDatabaseMetaData}} which causes the mentioned {{ArrayStoreException= }}.=20 --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.