commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r390763 - /jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java
Date Sat, 01 Apr 2006 23:58:21 GMT
Author: psteitz
Date: Sat Apr  1 15:58:19 2006
New Revision: 390763

URL: http://svn.apache.org/viewcvs?rev=390763&view=rev
Log:
Modified activateObject in PoolableConnection to test connection properties
before resetting to defaults.
Addresses BZ #31343

Modified:
    jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java

Modified: jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java?rev=390763&r1=390762&r2=390763&view=diff
==============================================================================
--- jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java
(original)
+++ jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolableConnectionFactory.java
Sat Apr  1 15:58:19 2006
@@ -368,14 +368,20 @@
         }
         if(obj instanceof Connection) {
             Connection conn = (Connection)obj;
-            conn.setAutoCommit(_defaultAutoCommit);
-            if (_defaultTransactionIsolation != UNKNOWN_TRANSACTIONISOLATION) {
+            if (conn.getAutoCommit() != _defaultAutoCommit) {
+                conn.setAutoCommit(_defaultAutoCommit);
+            }
+            if ((_defaultTransactionIsolation != UNKNOWN_TRANSACTIONISOLATION) 
+                    && (conn.getTransactionIsolation() != 
+                    _defaultTransactionIsolation)) {
                 conn.setTransactionIsolation(_defaultTransactionIsolation);
             }
-            if (_defaultReadOnly != null) {
+            if ((_defaultReadOnly != null) && 
+                    (conn.isReadOnly() != _defaultReadOnly.booleanValue())) {
                 conn.setReadOnly(_defaultReadOnly.booleanValue());
             }
-            if (_defaultCatalog != null) {
+            if ((_defaultCatalog != null) &&
+                    (conn.getCatalog() != _defaultCatalog)) {
                 conn.setCatalog(_defaultCatalog);
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message