commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve_Cl...@fws.gov
Subject [collections] [PATCH] AbstractMapBag.remove() bug
Date Thu, 14 Jul 2005 17:23:51 GMT
I can't get in to CVS to see if this is fixed, but there is a bug in 
AbstractMapBag in 3.1: BagIterator.remove() does not properly remove the 
last instance of a given item; the result is infinite looping.  Here is a 
patch.

-steve

Steve Clark
ECOS Development Group
steve_clark@fws.gov
(970)226-9291


--- AbstractMapBag.java.orig    2005-07-14 11:14:33.708373173 -0600
+++ AbstractMapBag.java 2005-07-14 11:15:30.566623793 -0600
@@ -221,7 +221,7 @@
                 throw new IllegalStateException();
             }
             MutableInteger mut = (MutableInteger) current.getValue();
-            if (mut.value > 0) {
+            if (mut.value > 1) {
                 mut.value--;
                 parent.size--;
             } else {


---------------------------------------------------------------------
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