You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by St...@fws.gov on 2005/07/14 19:23:51 UTC
[collections] [PATCH] AbstractMapBag.remove() bug
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
Re: [collections] [PATCH] AbstractMapBag.remove() bug
Posted by Stephen Colebourne <sc...@btopenworld.com>.
The proposed patch fixed half the problem.
Full fix and test case committed in svn r219131.
Stephen
Steve_Clark@fws.gov wrote:
> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org