diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2005-11-15 23:20:01 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2005-11-15 23:20:01 +0000 |
commit | 8f523f3a1047919d3563daf1ef47ba87336ebe89 (patch) | |
tree | a5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/java/util/WeakHashMap.java | |
parent | 02e549bfaaec38f68307e7f34e46ea57ea1809af (diff) | |
download | gcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.tar.gz |
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
From-SVN: r107049
Diffstat (limited to 'libjava/classpath/java/util/WeakHashMap.java')
-rw-r--r-- | libjava/classpath/java/util/WeakHashMap.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libjava/classpath/java/util/WeakHashMap.java b/libjava/classpath/java/util/WeakHashMap.java index 7593f7e330e..514ad8cd29f 100644 --- a/libjava/classpath/java/util/WeakHashMap.java +++ b/libjava/classpath/java/util/WeakHashMap.java @@ -241,7 +241,8 @@ public class WeakHashMap extends AbstractMap implements Map // This method will get inlined. cleanQueue(); if (knownMod != modCount) - throw new ConcurrentModificationException(); + throw new ConcurrentModificationException(knownMod + " != " + + modCount); } /** @@ -698,21 +699,20 @@ public class WeakHashMap extends AbstractMap implements Map // bucket may be enqueued later by the garbage collection, and // internalRemove will be called a second time. bucket.slot = -1; - if (buckets[slot] == bucket) - buckets[slot] = bucket.next; - else + + WeakBucket prev = null; + WeakBucket next = buckets[slot]; + while (next != bucket) { - WeakBucket prev = buckets[slot]; - /* This may throw a NullPointerException. It shouldn't but if - * a race condition occurred (two threads removing the same - * bucket at the same time) it may happen. <br> - * But with race condition many much worse things may happen - * anyway. - */ - while (prev.next != bucket) - prev = prev.next; - prev.next = bucket.next; + if (next == null) throw new InternalError("WeakHashMap in incosistent state"); + prev = next; + next = prev.next; } + if (prev == null) + buckets[slot] = bucket.next; + else + prev.next = bucket.next; + size--; } |