diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-14 05:32:31 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-14 05:32:31 +0000 |
commit | f78457c18e74ccf5683c88a96988e8ef276c42fc (patch) | |
tree | 4f2a41fd0521db9e0327c39ffe966d5f227e8cf6 /libjava | |
parent | cfd386ad0babbb02b7ee00af04f9f45efbaf583d (diff) | |
download | gcc-f78457c18e74ccf5683c88a96988e8ef276c42fc.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39658 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 10 | ||||
-rw-r--r-- | libjava/java/lang/natClass.cc | 8 | ||||
-rw-r--r-- | libjava/java/util/TreeMap.java | 25 |
3 files changed, 27 insertions, 16 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 6e8a5a4063f..35ac4789ea9 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -9,6 +9,16 @@ * java/util/SortedSet.java: Sync with classpath. * java/util/HashMap.java (hash): Use if statement instead of ternary, 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> diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc index 6678b7794cf..a1008d692d0 100644 --- a/libjava/java/lang/natClass.cc +++ b/libjava/java/lang/natClass.cc @@ -290,8 +290,12 @@ java::lang::Class::getSignature (JArray<jclass> *param_types, java::lang::StringBuffer *buf = new java::lang::StringBuffer (); buf->append((jchar) '('); jclass *v = elements (param_types); - for (int i = 0; i < param_types->length; ++i) - v[i]->getSignature(buf); + // A NULL param_types means "no parameters". + if (param_types != NULL) + { + for (int i = 0; i < param_types->length; ++i) + v[i]->getSignature(buf); + } buf->append((jchar) ')'); if (is_constructor) buf->append((jchar) 'V'); diff --git a/libjava/java/util/TreeMap.java b/libjava/java/util/TreeMap.java index ce111053299..5057d16fede 100644 --- a/libjava/java/util/TreeMap.java +++ b/libjava/java/util/TreeMap.java @@ -56,7 +56,7 @@ import java.io.IOException; * * @author Jon Zeppieri * @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 implements SortedMap, Cloneable, Serializable @@ -1194,10 +1194,10 @@ public class TreeMap extends AbstractMap public Object next() { - if (knownMod != TreeMap.this.modCount) - throw new ConcurrentModificationException(); if (next == nil) throw new NoSuchElementException(); + if (knownMod != TreeMap.this.modCount) + throw new ConcurrentModificationException(); Node n = next; // Check limit in case we are iterating through a submap. @@ -1217,11 +1217,10 @@ public class TreeMap extends AbstractMap public void remove() { - if (knownMod != TreeMap.this.modCount) - throw new ConcurrentModificationException(); - if (last == null) throw new IllegalStateException(); + if (knownMod != TreeMap.this.modCount) + throw new ConcurrentModificationException(); /* Object key = null; if (next != nil) @@ -1408,19 +1407,17 @@ public class TreeMap extends AbstractMap public Object firstKey() { Node node = lowestGreaterThan(minKey); - // Do a range check in case SubMap is empty. - if (keyInRange(node.key)) - return node.key; - return null; + if (node == nil || !keyInRange(node.key)) + throw new NoSuchElementException ("empty"); + return node.key; } public Object lastKey() { Node node = highestLessThan(maxKey); - // Do a range check in case SubMap is empty. - if (keyInRange(node.key)) - return node.key; - return null; + if (node == nil || !keyInRange(node.key)) + throw new NoSuchElementException ("empty"); + return node.key; } public SortedMap subMap(Object fromKey, Object toKey) |