commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joe...@apache.org
Subject svn commit: r1098877 - in /commons/proper/dbcp/trunk/src: java/org/apache/commons/dbcp/DelegatingConnection.java test/org/apache/commons/dbcp/TestDelegatingConnection.java
Date Tue, 03 May 2011 00:40:08 GMT
Author: joehni
Date: Tue May  3 00:40:07 2011
New Revision: 1098877

URL: http://svn.apache.org/viewvc?rev=1098877&view=rev
Log:
DBCP-359: DelegatingConnection.equals fails if both delegates are null

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingConnection.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingConnection.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingConnection.java?rev=1098877&r1=1098876&r2=1098877&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingConnection.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/DelegatingConnection.java Tue
May  3 00:40:07 2011
@@ -182,12 +182,10 @@ public class DelegatingConnection extend
             return true;
         }
         Connection delegate = getInnermostDelegateInternal();
-        if (delegate == null) {
-            return false;
-        }
         if (obj instanceof DelegatingConnection) {    
             DelegatingConnection c = (DelegatingConnection) obj;
-            return c.innermostDelegateEquals(delegate);
+            Connection cDelegate = c.getInnermostDelegateInternal();
+            return delegate == cDelegate || (delegate != null && delegate.equals(cDelegate));
         }
         else {
             return delegate.equals(obj);

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingConnection.java?rev=1098877&r1=1098876&r2=1098877&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingConnection.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestDelegatingConnection.java
Tue May  3 00:40:07 2011
@@ -81,6 +81,7 @@ public class TestDelegatingConnection ex
         assertTrue(conn3.equals(conn3));
         assertTrue(conn.equals(conn));
         assertTrue(conn2.equals(conn2));
+        assertTrue(conn3.equals(new DelegatingConnection(null)));
     }
     
     public void testCheckOpen() throws Exception {



Mime
View raw message