This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: PR 11241


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();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]