Fix bug in remove method from coverage testing

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131439 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-12-14 13:00:03 +00:00
parent f3eec92e78
commit c45a13dee2
1 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/StaticBucketMap.java,v 1.2 2003/12/06 13:03:15 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/StaticBucketMap.java,v 1.3 2003/12/14 13:00:03 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -132,7 +132,7 @@ import org.apache.commons.collections.KeyValue;
* operations will affect the map.<p> * operations will affect the map.<p>
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.2 $ $Date: 2003/12/06 13:03:15 $ * @version $Revision: 1.3 $ $Date: 2003/12/14 13:00:03 $
* *
* @author Berin Loritsch * @author Berin Loritsch
* @author Gerhard Froehlich * @author Gerhard Froehlich
@ -611,8 +611,11 @@ public final class StaticBucketMap implements Map {
return false; return false;
} }
public boolean remove(Object o) { public boolean remove(Object obj) {
Map.Entry entry = (Map.Entry)o; if (obj instanceof Map.Entry == false) {
return false;
}
Map.Entry entry = (Map.Entry)obj;
int hash = getHash(entry.getKey()); int hash = getHash(entry.getKey());
synchronized (m_locks[hash]) { synchronized (m_locks[hash]) {
for (Node n = m_buckets[hash]; n != null; n = n.next) { for (Node n = m_buckets[hash]; n != null; n = n.next) {