Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3A21D1064B for ; Tue, 3 Dec 2013 22:21:39 +0000 (UTC) Received: (qmail 84313 invoked by uid 500); 3 Dec 2013 22:21:38 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 84243 invoked by uid 500); 3 Dec 2013 22:21:38 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 84236 invoked by uid 99); 3 Dec 2013 22:21:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 22:21:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 22:21:35 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 88440238890B; Tue, 3 Dec 2013 22:21:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1547611 - /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java Date: Tue, 03 Dec 2013 22:21:14 -0000 To: commits@commons.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131203222114.88440238890B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: markt Date: Tue Dec 3 22:21:14 2013 New Revision: 1547611 URL: http://svn.apache.org/r1547611 Log: Add generics to DelegatingConnection This significantly increases the number of warnings but it is a necessary step to resolving the remaining warnings. Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java?rev=1547611&r1=1547610&r2=1547611&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java (original) +++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java Tue Dec 3 22:21:14 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -64,7 +64,7 @@ import java.util.concurrent.Executor; * @author Dirk Verbeeck * @version $Revision$ $Date$ */ -public class DelegatingConnection extends AbandonedTrace +public class DelegatingConnection extends AbandonedTrace implements Connection { /* JDBC_4_ANT_KEY_BEGIN */ @@ -73,10 +73,10 @@ public class DelegatingConnection extend /* JDBC_4_ANT_KEY_END */ /** My delegate {@link Connection}. */ - private Connection _conn = null; + private C _conn = null; protected boolean _closed = false; // TODO make private and add getter/setter? - + private boolean _cacheState = true; private Boolean _autoCommitCached = null; private Boolean _readOnlyCached = null; @@ -87,7 +87,7 @@ public class DelegatingConnection extend * * @param c the {@link Connection} to delegate all calls to. */ - public DelegatingConnection(Connection c) { + public DelegatingConnection(C c) { super(); _conn = c; } @@ -96,13 +96,13 @@ public class DelegatingConnection extend /** * Returns a string representation of the metadata associated with * the innnermost delegate connection. - * + * * @since 1.2.2 */ @Override public String toString() { String s = null; - + Connection c = this.getInnermostDelegateInternal(); if (c != null) { try { @@ -126,11 +126,11 @@ public class DelegatingConnection extend // Ignore } } - + if (s == null) { s = super.toString(); } - + return s; } @@ -141,14 +141,14 @@ public class DelegatingConnection extend public Connection getDelegate() { return getDelegateInternal(); } - + protected final Connection getDelegateInternal() { return _conn; } - + /** * Compares innermost delegate to the given connection. - * + * * @param c connection to compare innermost delegate with * @return true if innermost delegate equals c * @since 1.2.2 @@ -163,7 +163,7 @@ public class DelegatingConnection extend } /** - * This method considers two objects to be equal + * This method considers two objects to be equal * if the underlying jdbc objects are equal. */ @Override @@ -175,8 +175,8 @@ public class DelegatingConnection extend return true; } Connection delegate = getInnermostDelegateInternal(); - if (obj instanceof DelegatingConnection) { - DelegatingConnection c = (DelegatingConnection) obj; + if (obj instanceof DelegatingConnection) { + DelegatingConnection c = (DelegatingConnection) obj; Connection cDelegate = c.getInnermostDelegateInternal(); return delegate == cDelegate || (delegate != null && delegate.equals(cDelegate)); } @@ -217,16 +217,16 @@ public class DelegatingConnection extend protected final Connection getInnermostDelegateInternal() { Connection c = _conn; while(c != null && c instanceof DelegatingConnection) { - c = ((DelegatingConnection)c).getDelegateInternal(); + c = ((DelegatingConnection)c).getDelegateInternal(); if(this == c) { return null; } } return c; } - + /** Sets my delegate. */ - public void setDelegate(Connection c) { + public void setDelegate(C c) { _conn = c; } @@ -258,7 +258,7 @@ public class DelegatingConnection extend } } } - + protected void handleException(SQLException e) throws SQLException { throw e; } @@ -356,7 +356,7 @@ public class DelegatingConnection extend } } - + @Override public void commit() throws SQLException { checkOpen(); @@ -367,10 +367,10 @@ public class DelegatingConnection extend } } - + /** * Returns the state caching flag. - * + * * @return the state caching flag */ public boolean getCacheState() { @@ -389,7 +389,7 @@ public class DelegatingConnection extend } catch (SQLException e) { handleException(e); return false; - } + } } @@ -404,7 +404,7 @@ public class DelegatingConnection extend } } - + @Override public DatabaseMetaData getMetaData() throws SQLException { checkOpen(); @@ -415,7 +415,7 @@ public class DelegatingConnection extend return null; } } - + @Override public int getTransactionIsolation() throws SQLException { @@ -452,7 +452,7 @@ public class DelegatingConnection extend } } - + @Override public boolean isReadOnly() throws SQLException { checkOpen(); @@ -491,10 +491,10 @@ public class DelegatingConnection extend } } - + /** * Sets the state caching flag. - * + * * @param cacheState The new value for the state caching flag */ public void setCacheState(boolean cacheState) { @@ -509,7 +509,7 @@ public class DelegatingConnection extend _autoCommitCached = null; _readOnlyCached = null; if (_conn instanceof DelegatingConnection) { - ((DelegatingConnection)_conn).clearCachedState(); + ((DelegatingConnection)_conn).clearCachedState(); } } @@ -587,7 +587,7 @@ public class DelegatingConnection extend } else { throw new SQLException ("Connection is null."); - } + } } } @@ -595,7 +595,7 @@ public class DelegatingConnection extend _closed = false; setLastUsed(); if(_conn instanceof DelegatingConnection) { - ((DelegatingConnection)_conn).activate(); + ((DelegatingConnection)_conn).activate(); } }