Author: markt Date: Tue Mar 15 14:29:11 2016 New Revision: 1735080 URL: http://svn.apache.org/viewvc?rev=1735080&view=rev Log: Fix POOL-306 Ensure BaseGenericObjectPool.IdentityWrapper#equals() follows the expected contract for equals().
Modified: commons/proper/pool/trunk/src/changes/changes.xml commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java Modified: commons/proper/pool/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1735080&r1=1735079&r2=1735080&view=diff ============================================================================== --- commons/proper/pool/trunk/src/changes/changes.xml (original) +++ commons/proper/pool/trunk/src/changes/changes.xml Tue Mar 15 14:29:11 2016 @@ -47,6 +47,10 @@ The <action> type attribute can be add,u <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."> Modified: commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java?rev=1735080&r1=1735079&r2=1735080&view=diff ============================================================================== --- commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java (original) +++ commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java Tue Mar 15 14:29:11 2016 @@ -1207,7 +1207,8 @@ public abstract class BaseGenericObjectP @Override @SuppressWarnings("rawtypes") public boolean equals(final Object other) { - return ((IdentityWrapper) other).instance == instance; + return other instanceof IdentityWrapper && + ((IdentityWrapper) other).instance == instance; } /**