Commit a04045d0 by Tom Tromey Committed by Tom Tromey

re PR libgcj/11241 (WeakHashMap throws a "/ zero" ArithmeticException when…

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
parent 6e42faef
2003-08-01 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.
2003-08-01 Stephen Crawley <crawley@dstc.edu.au>
* java/net/SocketImpl.java (toString): Display the remote address
......
/* 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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment