Commit 97a4d32e by Bryce McKinlay Committed by Bryce McKinlay

natClass.cc (getSignature): Don't try to dereference param_types if it is null.

	* java/lang/natClass.cc (getSignature): Don't try to dereference
	param_types if it is null. Instead, take this to mean "no parameters".
	* java/lang/TreeMap.java (TreeIterator.next): Throw
	NoSuchElementException in preference to
	ConcurrentModificationException.
	(TreeIterator.remove): Throw IllegalStateException in preference to
	ConcurrentModificationException.
	(SubMap.firstKey): Do a better check for empty SubMap, and if it is,
	throw a NoSuchElementException.
	(SubMap.lastKey): Likewise.

From-SVN: r39658
parent a142a996
...@@ -9,6 +9,16 @@ ...@@ -9,6 +9,16 @@
* java/util/SortedSet.java: Sync with classpath. * java/util/SortedSet.java: Sync with classpath.
* java/util/HashMap.java (hash): Use if statement instead of ternary, * java/util/HashMap.java (hash): Use if statement instead of ternary,
for clarity. for clarity.
* java/lang/natClass.cc (getSignature): Don't try to dereference
param_types if it is null. Instead, take this to mean "no parameters".
* java/lang/TreeMap.java (TreeIterator.next): Throw
NoSuchElementException in preference to ConcurrentModificationException.
(TreeIterator.remove): Throw IllegalStateException in preference to
ConcurrentModificationException.
(SubMap.firstKey): Do a better check for empty SubMap, and if it is,
throw a NoSuchElementException.
(SubMap.lastKey): Likewise.
2001-02-13 Tom Tromey <tromey@redhat.com> 2001-02-13 Tom Tromey <tromey@redhat.com>
......
...@@ -290,8 +290,12 @@ java::lang::Class::getSignature (JArray<jclass> *param_types, ...@@ -290,8 +290,12 @@ java::lang::Class::getSignature (JArray<jclass> *param_types,
java::lang::StringBuffer *buf = new java::lang::StringBuffer (); java::lang::StringBuffer *buf = new java::lang::StringBuffer ();
buf->append((jchar) '('); buf->append((jchar) '(');
jclass *v = elements (param_types); jclass *v = elements (param_types);
for (int i = 0; i < param_types->length; ++i) // A NULL param_types means "no parameters".
v[i]->getSignature(buf); if (param_types != NULL)
{
for (int i = 0; i < param_types->length; ++i)
v[i]->getSignature(buf);
}
buf->append((jchar) ')'); buf->append((jchar) ')');
if (is_constructor) if (is_constructor)
buf->append((jchar) 'V'); buf->append((jchar) 'V');
......
...@@ -56,7 +56,7 @@ import java.io.IOException; ...@@ -56,7 +56,7 @@ import java.io.IOException;
* *
* @author Jon Zeppieri * @author Jon Zeppieri
* @author Bryce McKinlay * @author Bryce McKinlay
* @modified $Id: TreeMap.java,v 1.8 2000/10/26 10:19:01 bryce Exp $ * @modified $Id: TreeMap.java,v 1.1 2001/02/14 04:44:21 bryce Exp $
*/ */
public class TreeMap extends AbstractMap public class TreeMap extends AbstractMap
implements SortedMap, Cloneable, Serializable implements SortedMap, Cloneable, Serializable
...@@ -1194,10 +1194,10 @@ public class TreeMap extends AbstractMap ...@@ -1194,10 +1194,10 @@ public class TreeMap extends AbstractMap
public Object next() public Object next()
{ {
if (knownMod != TreeMap.this.modCount)
throw new ConcurrentModificationException();
if (next == nil) if (next == nil)
throw new NoSuchElementException(); throw new NoSuchElementException();
if (knownMod != TreeMap.this.modCount)
throw new ConcurrentModificationException();
Node n = next; Node n = next;
// Check limit in case we are iterating through a submap. // Check limit in case we are iterating through a submap.
...@@ -1217,11 +1217,10 @@ public class TreeMap extends AbstractMap ...@@ -1217,11 +1217,10 @@ public class TreeMap extends AbstractMap
public void remove() public void remove()
{ {
if (knownMod != TreeMap.this.modCount)
throw new ConcurrentModificationException();
if (last == null) if (last == null)
throw new IllegalStateException(); throw new IllegalStateException();
if (knownMod != TreeMap.this.modCount)
throw new ConcurrentModificationException();
/* /*
Object key = null; Object key = null;
if (next != nil) if (next != nil)
...@@ -1408,19 +1407,17 @@ public class TreeMap extends AbstractMap ...@@ -1408,19 +1407,17 @@ public class TreeMap extends AbstractMap
public Object firstKey() public Object firstKey()
{ {
Node node = lowestGreaterThan(minKey); Node node = lowestGreaterThan(minKey);
// Do a range check in case SubMap is empty. if (node == nil || !keyInRange(node.key))
if (keyInRange(node.key)) throw new NoSuchElementException ("empty");
return node.key; return node.key;
return null;
} }
public Object lastKey() public Object lastKey()
{ {
Node node = highestLessThan(maxKey); Node node = highestLessThan(maxKey);
// Do a range check in case SubMap is empty. if (node == nil || !keyInRange(node.key))
if (keyInRange(node.key)) throw new NoSuchElementException ("empty");
return node.key; return node.key;
return null;
} }
public SortedMap subMap(Object fromKey, Object toKey) public SortedMap subMap(Object fromKey, Object toKey)
......
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