aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@albatross.co.nz>2001-02-22 04:16:07 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2001-02-22 04:16:07 +0000
commit810e8b5200c3e59dddb0fb5e43d46290ec400927 (patch)
tree6bf010a67cccbe03b819b7320a3cd43e49919b7a /libjava
parent7a6f7290413b2209ab01506a2a832eb3f9d3ca8b (diff)
downloadgcc-810e8b5200c3e59dddb0fb5e43d46290ec400927.zip
gcc-810e8b5200c3e59dddb0fb5e43d46290ec400927.tar.gz
gcc-810e8b5200c3e59dddb0fb5e43d46290ec400927.tar.bz2
re PR java/2040 (java.util.Hashtable(int,float) is stricter than sun's version)
Fix for PR java/2040: * java/util/HashMap.java (HashMap): Don't throw exception for loadFactor > 1. Add exception messages. * java/util/Hashtable.java (Hashtable): Likewise. From-SVN: r39969
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/java/util/HashMap.java14
-rw-r--r--libjava/java/util/Hashtable.java21
3 files changed, 22 insertions, 20 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 2693f74..4b73b5c 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,10 @@
+2001-02-22 Bryce McKinlay <bryce@albatross.co.nz>
+
+ Fix for PR java/2040:
+ * java/util/HashMap.java (HashMap): Don't throw exception for
+ loadFactor > 1. Add exception messages.
+ * java/util/Hashtable.java (Hashtable): Likewise.
+
2001-02-20 Tom Tromey <tromey@redhat.com>
* java/io/PipedWriter.java (flush): Throw exception if stream
diff --git a/libjava/java/util/HashMap.java b/libjava/java/util/HashMap.java
index 6304333..bf10e9e 100644
--- a/libjava/java/util/HashMap.java
+++ b/libjava/java/util/HashMap.java
@@ -60,8 +60,6 @@ import java.io.ObjectOutputStream;
* @author Jon Zeppieri
* @author Jochen Hoenicke
* @author Bryce McKinlay
- * @version $Revision: 1.4 $
- * @modified $Id: HashMap.java,v 1.4 2000/12/21 02:00:15 bryce Exp $
*/
public class HashMap extends AbstractMap
implements Map, Cloneable, Serializable
@@ -160,14 +158,16 @@ public class HashMap extends AbstractMap
*
* @throws IllegalArgumentException if (initialCapacity < 0) ||
* (initialLoadFactor > 1.0) ||
- * (initialLoadFactor <= 0.0)
*/
public HashMap(int initialCapacity, float loadFactor)
throws IllegalArgumentException
{
- if (initialCapacity < 0 || loadFactor <= 0 || loadFactor > 1)
- throw new IllegalArgumentException();
-
+ if (initialCapacity < 0)
+ throw new IllegalArgumentException("Illegal Initial Capacity: "
+ + initialCapacity);
+ if (loadFactor <= 0)
+ throw new IllegalArgumentException("Illegal Load Factor: " + loadFactor);
+
buckets = new Entry[initialCapacity];
this.loadFactor = loadFactor;
this.threshold = (int) (initialCapacity * loadFactor);
@@ -619,8 +619,6 @@ public class HashMap extends AbstractMap
* keys, values, or entries.
*
* @author Jon Zeppieri
- * @version $Revision: 1.4 $
- * @modified $Id: HashMap.java,v 1.4 2000/12/21 02:00:15 bryce Exp $
*/
class HashIterator implements Iterator
{
diff --git a/libjava/java/util/Hashtable.java b/libjava/java/util/Hashtable.java
index 9585872..4fd8167 100644
--- a/libjava/java/util/Hashtable.java
+++ b/libjava/java/util/Hashtable.java
@@ -64,8 +64,6 @@ import java.io.ObjectOutputStream;
* @author Jon Zeppieri
* @author Warren Levy
* @author Bryce McKinlay
- * @version $Revision: 1.9 $
- * @modified $Id: Hashtable.java,v 1.9 2000/12/17 09:15:51 bryce Exp $
*/
public class Hashtable extends Dictionary
implements Map, Cloneable, Serializable
@@ -171,15 +169,17 @@ public class Hashtable extends Dictionary
* @param loadFactor the load factor
*
* @throws IllegalArgumentException if (initialCapacity < 0) ||
- * (initialLoadFactor > 1.0) ||
* (initialLoadFactor <= 0.0)
*/
public Hashtable(int initialCapacity, float loadFactor)
throws IllegalArgumentException
{
- if (initialCapacity < 0 || loadFactor <= 0 || loadFactor > 1)
- throw new IllegalArgumentException();
-
+ if (initialCapacity < 0)
+ throw new IllegalArgumentException("Illegal Initial Capacity: "
+ + initialCapacity);
+ if (loadFactor <= 0)
+ throw new IllegalArgumentException("Illegal Load Factor: " + loadFactor);
+
buckets = new Entry[initialCapacity];
this.loadFactor = loadFactor;
this.threshold = (int) (initialCapacity * loadFactor);
@@ -721,8 +721,6 @@ public class Hashtable extends Dictionary
* as per the Javasoft spec.
*
* @author Jon Zeppieri
- * @version $Revision: 1.9 $
- * @modified $Id: Hashtable.java,v 1.9 2000/12/17 09:15:51 bryce Exp $
*/
class HashIterator implements Iterator
{
@@ -818,16 +816,15 @@ public class Hashtable extends Dictionary
* elements; this implementation is parameterized to provide access either
* to the keys or to the values in the Hashtable.
*
- * <b>NOTE: Enumeration is not safe if new elements are put in the table as
- * this could cause a rehash and we'd completely lose our place. Even
+ * <b>NOTE</b>: Enumeration is not safe if new elements are put in the table
+ * as this could cause a rehash and we'd completely lose our place. Even
* without a rehash, it is undetermined if a new element added would
* appear in the enumeration. The spec says nothing about this, but
* the "Java Class Libraries" book infers that modifications to the
* hashtable during enumeration causes indeterminate results. Don't do it!
*
* @author Jon Zeppieri
- * @version $Revision: 1.9 $
- * @modified $Id: Hashtable.java,v 1.9 2000/12/17 09:15:51 bryce Exp $ */
+ */
class Enumerator implements Enumeration
{
static final int KEYS = 0;