java.util.TreeMap patch

Eric Blake ebb9@email.byu.edu
Sat Dec 21 13:22:00 GMT 2002


Do I have permission to apply this patch to the trunk and 3.3 branch? I 
just applied this to Classpath.

2002-12-21  Eric Blake  <ebb9@email.byu.edu>

        * java/util/TreeMap.java (fabricateTree): Fix off-by-one error.
        (TreeIterator.remove): Prefer IllegalStateException over
        ConcurrentModificationException, to match Sun.

Index: java/util/TreeMap.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/TreeMap.java,v
retrieving revision 1.8
diff -u -r1.8 TreeMap.java
--- java/util/TreeMap.java      18 Jun 2002 15:40:02 -0000      1.8
+++ java/util/TreeMap.java      21 Dec 2002 21:17:48 -0000
@@ -865,7 +865,7 @@
      int rowsize;

      // Fill each row that is completely full of nodes.
-    for (rowsize = 2; rowsize + rowsize < count; rowsize <<= 1)
+    for (rowsize = 2; rowsize + rowsize <= count; rowsize <<= 1)
        {
          Node parent = row;
          Node last = null;
@@ -1468,10 +1468,10 @@
       */
      public void remove()
      {
-      if (knownMod != modCount)
-        throw new ConcurrentModificationException();
        if (last == null)
          throw new IllegalStateException();
+      if (knownMod != modCount)
+        throw new ConcurrentModificationException();

        removeNode(last);
        last = null;

-- 
This signature intentionally left boring.

Eric Blake             ebb9@email.byu.edu
   BYU student, free software programmer




More information about the Java-patches mailing list