Commit 29456fb8 by Eric Blake Committed by Tom Tromey

TreeMap.java (fabricateTree): Fix off-by-one error.

2003-01-03  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.

From-SVN: r60837
parent e392d367
2003-01-03 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-22 Anthony Green <green@redhat.com> 2002-12-22 Anthony Green <green@redhat.com>
* boehm.cc (_Jv_MarkObj): Mark the protectionDomain of a class. * boehm.cc (_Jv_MarkObj): Mark the protectionDomain of a class.
......
...@@ -865,7 +865,7 @@ public class TreeMap extends AbstractMap ...@@ -865,7 +865,7 @@ public class TreeMap extends AbstractMap
int rowsize; int rowsize;
// Fill each row that is completely full of nodes. // 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 parent = row;
Node last = null; Node last = null;
...@@ -1468,10 +1468,10 @@ public class TreeMap extends AbstractMap ...@@ -1468,10 +1468,10 @@ public class TreeMap extends AbstractMap
*/ */
public void remove() public void remove()
{ {
if (knownMod != modCount)
throw new ConcurrentModificationException();
if (last == null) if (last == null)
throw new IllegalStateException(); throw new IllegalStateException();
if (knownMod != modCount)
throw new ConcurrentModificationException();
removeNode(last); removeNode(last);
last = null; last = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment