Author: markt
Date: Tue Dec  3 21:43:44 2013
New Revision: 1547598

URL: http://svn.apache.org/r1547598
Log:
Rather than always cast and let things blow up at runtime if the developer gets 
it wrong, use the required type in the API and highlight any issue at compile 
time.

Modified:
    
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
    
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PoolablePreparedStatementStub.java

Modified: 
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
URL: 
http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java?rev=1547598&r1=1547597&r2=1547598&view=diff
==============================================================================
--- 
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
 (original)
+++ 
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
 Tue Dec  3 21:43:44 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.
@@ -61,12 +61,12 @@ public class PoolablePreparedStatement<K
      */
     public PoolablePreparedStatement(PreparedStatement stmt, K key,
             KeyedObjectPool<K, PoolablePreparedStatement<K,S>> pool,
-            Connection conn) {
-        super((DelegatingConnection) conn, stmt);
+            DelegatingConnection conn) {
+        super(conn, stmt);
         _pool = pool;
         _key = key;
 
-        // Remove from trace now because this statement will be 
+        // Remove from trace now because this statement will be
         // added by the activate method.
         if(_conn != null) {
             _conn.removeTrace(this);
@@ -109,7 +109,7 @@ public class PoolablePreparedStatement<K
             }
         }
     }
-    
+
     @Override
     public void activate() throws SQLException{
         _closed = false;
@@ -118,7 +118,7 @@ public class PoolablePreparedStatement<K
         }
         super.activate();
     }
-  
+
     @Override
     public void passivate() throws SQLException {
         _closed = true;
@@ -141,7 +141,7 @@ public class PoolablePreparedStatement<K
         if (batchAdded) {
             clearBatch();
         }
-        
+
         super.passivate();
     }
 

Modified: 
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PoolablePreparedStatementStub.java
URL: 
http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PoolablePreparedStatementStub.java?rev=1547598&r1=1547597&r2=1547598&view=diff
==============================================================================
--- 
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PoolablePreparedStatementStub.java
 (original)
+++ 
commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PoolablePreparedStatementStub.java
 Tue Dec  3 21:43:44 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.
@@ -21,6 +21,7 @@ import java.sql.PreparedStatement;
 import java.sql.Connection;
 import java.sql.SQLException;
 import org.apache.commons.pool2.KeyedObjectPool;
+import org.apache.commons.dbcp2.DelegatingConnection;
 import org.apache.commons.dbcp2.PoolablePreparedStatement;
 
 /**
@@ -43,7 +44,7 @@ class PoolablePreparedStatementStub exte
     public PoolablePreparedStatementStub(PreparedStatement stmt,
             PStmtKeyCPDS key,
             KeyedObjectPool<PStmtKeyCPDS, 
PoolablePreparedStatement<PStmtKeyCPDS, PoolablePreparedStatementStub>> pool,
-            Connection conn) {
+            DelegatingConnection conn) {
         super(stmt, key, pool, conn);
     }
 


Reply via email to