diff options
author | Tom Tromey <tromey@redhat.com> | 2003-08-01 21:30:14 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2003-08-01 21:30:14 +0000 |
commit | a04045d0a2b27fd61781d9babc27831bc26afbfd (patch) | |
tree | a0672a281d2ca00e3af1ca2565488e06511dc7ef /libjava/java/util/WeakHashMap.java | |
parent | 6e42faef6d3889aeb4b4072f4719755d9e262fdf (diff) | |
download | gcc-a04045d0a2b27fd61781d9babc27831bc26afbfd.zip gcc-a04045d0a2b27fd61781d9babc27831bc26afbfd.tar.gz gcc-a04045d0a2b27fd61781d9babc27831bc26afbfd.tar.bz2 |
re PR libgcj/11241 (WeakHashMap throws a "/ zero" ArithmeticException when initialCapacity is explicitly zero)
Fix for PR libgcj/11241:
* java/util/WeakHashMap.java (WeakHashMap(int,float)): If
initialCapacity is 0, set it to 1.
From-SVN: r70070
Diffstat (limited to 'libjava/java/util/WeakHashMap.java')
-rw-r--r-- | libjava/java/util/WeakHashMap.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libjava/java/util/WeakHashMap.java b/libjava/java/util/WeakHashMap.java index 3431ac9..4cce821 100644 --- a/libjava/java/util/WeakHashMap.java +++ b/libjava/java/util/WeakHashMap.java @@ -1,6 +1,6 @@ /* WeakHashMap -- a hashtable that keeps only weak references to its keys, allowing the virtual machine to reclaim them - Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -544,6 +544,8 @@ public class WeakHashMap extends AbstractMap implements Map // Check loadFactor for NaN as well. if (initialCapacity < 0 || ! (loadFactor > 0)) throw new IllegalArgumentException(); + if (initialCapacity == 0) + initialCapacity = 1; this.loadFactor = loadFactor; threshold = (int) (initialCapacity * loadFactor); theEntrySet = new WeakEntrySet(); |