This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: PR 11241
- From: Tom Tromey <tromey at redhat dot com>
- To: GCC libjava patches <java-patches at gcc dot gnu dot org>
- Date: 01 Aug 2003 15:30:16 -0600
- Subject: Patch: FYI: PR 11241
- Reply-to: tromey at redhat dot com
Oops, I forgot to send this before checking in the fix.
This fixes PR 11241 in the obvious way. This is what HashMap does as
well...
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
Fix for PR libgcj/11241:
* java/util/WeakHashMap.java (WeakHashMap(int,float)): If
initialCapacity is 0, set it to 1.
Index: java/util/WeakHashMap.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/WeakHashMap.java,v
retrieving revision 1.6
diff -u -r1.6 WeakHashMap.java
--- java/util/WeakHashMap.java 18 Jun 2002 15:40:05 -0000 1.6
+++ java/util/WeakHashMap.java 1 Aug 2003 21:10:55 -0000
@@ -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 @@
// 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();