You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2017/03/12 19:47:54 UTC

[24/50] [abbrv] commons-pool git commit: Fix POOL-306 Ensure BaseGenericObjectPool.IdentityWrapper#equals() follows the expected contract for equals().

Fix POOL-306
Ensure BaseGenericObjectPool.IdentityWrapper#equals() follows the expected contract for equals().

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/pool/trunk@1735080 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-pool/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-pool/commit/a898de84
Tree: http://git-wip-us.apache.org/repos/asf/commons-pool/tree/a898de84
Diff: http://git-wip-us.apache.org/repos/asf/commons-pool/diff/a898de84

Branch: refs/heads/master
Commit: a898de843abe44f5f0910b271a89b60e884852a5
Parents: 2566fd6
Author: Mark Thomas <ma...@apache.org>
Authored: Tue Mar 15 14:29:11 2016 +0000
Committer: Mark Thomas <ma...@apache.org>
Committed: Tue Mar 15 14:29:11 2016 +0000

----------------------------------------------------------------------
 src/changes/changes.xml                                          | 4 ++++
 .../org/apache/commons/pool2/impl/BaseGenericObjectPool.java     | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-pool/blob/a898de84/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f5d27d4..f515689 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -47,6 +47,10 @@ The <action> type attribute can be add,update,fix,remove.
     <action dev="ggregory" issue="POOL-309" type="fix" due-to="jolestar, Roopam Patekar">
       Fix misspellings from "destory" to "destroy".
     </action>
+    <action dev="markt" issue="POOL-306" type="fix" due-to="Adrian Crum">
+      Ensure BaseGenericObjectPool.IdentityWrapper#equals() follows the expected
+      contract for equals(). 
+    </action>
   </release>
   <release version="2.4.2" date="2015-08-01" description=
  "This is a patch release, including bug fixes only.">

http://git-wip-us.apache.org/repos/asf/commons-pool/blob/a898de84/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
index 6e197c9..8d5efbd 100644
--- a/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
@@ -1207,7 +1207,8 @@ public abstract class BaseGenericObjectPool<T> extends BaseObject {
         @Override
         @SuppressWarnings("rawtypes")
         public boolean equals(final Object other) {
-            return ((IdentityWrapper) other).instance == instance;
+            return  other instanceof IdentityWrapper &&
+                    ((IdentityWrapper) other).instance == instance;
         }
 
         /**