summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2002-12-21 20:15:08 +0000
committerEric Blake <ebb9@byu.net>2002-12-21 20:15:08 +0000
commit6923273bdd03b585338096b7a71c354523a66400 (patch)
treeadb6b0817d3d64d98eb45c086e3b8da77a09bbf0
parentd6a8938bae94d3f9e9755be5fca0e4bfadd58e8f (diff)
downloadclasspath-6923273bdd03b585338096b7a71c354523a66400.tar.gz
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.
-rw-r--r--ChangeLog6
-rw-r--r--java/util/TreeMap.java6
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 89a1b5a97..5fe5ce7d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2002-12-21 Michael Koch <konqueror@gmx.de>
* java/nio/channels/FileChannel.java
diff --git a/java/util/TreeMap.java b/java/util/TreeMap.java
index dfa9bc638..e0cff28e0 100644
--- a/java/util/TreeMap.java
+++ b/java/util/TreeMap.java
@@ -865,7 +865,7 @@ public class TreeMap extends AbstractMap
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 class TreeMap extends AbstractMap
*/
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;