Initial load
diff --git a/test/java/util/Hashtable/EqualsCast.java b/test/java/util/Hashtable/EqualsCast.java
new file mode 100644
index 0000000..59d68ac
--- /dev/null
+++ b/test/java/util/Hashtable/EqualsCast.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 1999 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 4208530
+ * @summary Hashtable was less robust to extension that it could have been
+ *          because the equals and Hashcode methods used internals
+ *          unnecessarily.  (java.security.Provider tickled this sensitivity.)
+ */
+
+import java.util.*;
+import java.security.Provider;
+
+public class EqualsCast {
+    public static void main(String[] args) throws Exception {
+        Map m1 = new MyProvider("foo", 69, "baz");
+        Map m2 = new MyProvider("foo", 69, "baz");
+        m1.equals(m2);
+    }
+}
+
+class MyProvider extends Provider {
+
+    private String name;
+
+    public MyProvider(String name, double version, String info) {
+        super(name, version, info);
+        this.name = name;
+        put("Signature.sigalg", "sigimpl");
+    }
+
+    public String getName() {
+        return this.name;
+    }
+}
diff --git a/test/java/util/Hashtable/HashCode.java b/test/java/util/Hashtable/HashCode.java
new file mode 100644
index 0000000..0212f71
--- /dev/null
+++ b/test/java/util/Hashtable/HashCode.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 4559052
+ * @summary Hashtable's hashCode method always returns zero(!)
+ * @author Josh Bloch
+ */
+
+import java.util.*;
+
+public class HashCode {
+    public static void main(String[] args) throws Exception {
+        Map m = new Hashtable();
+        if (m.hashCode() != 0)
+            throw new Exception("Empty Hashtable has nonzero hashCode.");
+
+        m.put("Joe", "Blow");
+        if (m.hashCode() != ("Joe".hashCode() ^ "Blow".hashCode()))
+            throw new Exception("Non-empty Hashtable has wrong hashCode.");
+    }
+}
diff --git a/test/java/util/Hashtable/IllegalLoadFactor.java b/test/java/util/Hashtable/IllegalLoadFactor.java
new file mode 100644
index 0000000..1df98b2
--- /dev/null
+++ b/test/java/util/Hashtable/IllegalLoadFactor.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 1997-1998 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 4093817 4189594
+   @summary Test for an illegalargumentexception on loadFactor
+*/
+
+
+
+import java.util.*;
+
+/**
+ * This class tests to see if creating a hash table with an
+ * illegal value of loadFactor results in an IllegalArgumentException
+ */
+public class IllegalLoadFactor {
+
+      public static void main(String argv[]) throws Exception {
+          boolean testSucceeded = false;
+          try{
+              // this should generate an IllegalArgumentException
+              Hashtable bad1 = new Hashtable(100, -3);
+          }
+          catch (IllegalArgumentException e1) {
+              testSucceeded = true;
+          }
+          if(!testSucceeded)
+              throw new Exception("Hashtable, negative load factor");
+
+          testSucceeded = false;
+          try{
+              // this should generate an IllegalArgumentException
+              Hashtable bad1 = new Hashtable(100, Float.NaN);
+          }
+          catch (IllegalArgumentException e1) {
+              testSucceeded = true;
+          }
+          if(!testSucceeded)
+              throw new Exception("Hashtable, NaN load factor");
+
+          testSucceeded = false;
+          try{
+              // this should generate an IllegalArgumentException
+              HashMap bad1 = new HashMap(100, -3);
+          }
+          catch (IllegalArgumentException e1) {
+              testSucceeded = true;
+          }
+          if(!testSucceeded)
+              throw new Exception("HashMap, negative load factor");
+
+          testSucceeded = false;
+          try{
+              // this should generate an IllegalArgumentException
+              HashMap bad1 = new HashMap(100, Float.NaN);
+          }
+          catch (IllegalArgumentException e1) {
+              testSucceeded = true;
+          }
+          if(!testSucceeded)
+              throw new Exception("HashMap, NaN load factor");
+
+
+          testSucceeded = false;
+          try{
+              // this should generate an IllegalArgumentException
+              HashSet bad1 = new HashSet(100, -3);
+          }
+          catch (IllegalArgumentException e1) {
+              testSucceeded = true;
+          }
+          if(!testSucceeded)
+              throw new Exception("HashSet, negative load factor");
+
+          testSucceeded = false;
+          try{
+              // this should generate an IllegalArgumentException
+              HashSet bad1 = new HashSet(100, Float.NaN);
+          }
+          catch (IllegalArgumentException e1) {
+              testSucceeded = true;
+          }
+          if(!testSucceeded)
+              throw new Exception("HashSet, NaN load factor");
+
+          testSucceeded = false;
+          try{
+              // this should generate an IllegalArgumentException
+              WeakHashMap bad1 = new WeakHashMap(100, -3);
+          }
+          catch (IllegalArgumentException e1) {
+              testSucceeded = true;
+          }
+          if(!testSucceeded)
+              throw new Exception("WeakHashMap, negative load factor");
+
+          testSucceeded = false;
+          try{
+              // this should generate an IllegalArgumentException
+              WeakHashMap bad1 = new WeakHashMap(100, Float.NaN);
+          }
+          catch (IllegalArgumentException e1) {
+              testSucceeded = true;
+          }
+          if(!testSucceeded)
+              throw new Exception("WeakHashMap, NaN load factor");
+
+          // Make sure that legal creates don't throw exceptions
+          Map goodMap = new Hashtable(100, .69f);
+          goodMap = new HashMap(100, .69f);
+          Set goodSet = new HashSet(100, .69f);
+          goodMap = new WeakHashMap(100, .69f);
+     }
+
+}
diff --git a/test/java/util/Hashtable/ReadObject.java b/test/java/util/Hashtable/ReadObject.java
new file mode 100644
index 0000000..0f1a61a
--- /dev/null
+++ b/test/java/util/Hashtable/ReadObject.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 4652911
+ * @summary test Hashtable readObject for invocation of overridable put method
+ */
+import java.util.Hashtable;
+
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * Class that extends Hashtable to demonstrate bug when
+ * subclass wraps the values put into the Hashtable.
+ */
+public class ReadObject extends Hashtable {
+    /**
+     * Wraps the values put into MyHashtable objects
+     */
+    class ValueWrapper implements Serializable {
+        private Object mValue;
+
+        ValueWrapper(Object value) {
+            mValue = value;
+        }
+
+        Object getValue() {
+            return mValue;
+        }
+    };
+
+    public Object get(Object key) {
+        ValueWrapper valueWrapper = (ValueWrapper)super.get(key);
+        Object value = valueWrapper.getValue();
+        if(value instanceof ValueWrapper)
+            throw new RuntimeException("Hashtable.get bug");
+        return value;
+    }
+
+    public Object put(Object key, Object value) {
+        if(value instanceof ValueWrapper)
+            throw new RuntimeException(
+                "Hashtable.put bug: value is already wrapped");
+        ValueWrapper valueWrapper = new ValueWrapper(value);
+        super.put(key, valueWrapper);
+        return value;
+    }
+
+    private static Object copyObject(Object oldObj) {
+        Object newObj = null;
+        try {
+           //Create a stream in which to serialize the object.
+            ByteArrayOutputStream ostream = new ByteArrayOutputStream();
+            ObjectOutputStream p = new ObjectOutputStream(ostream);
+            //Serialize the object into the stream
+            p.writeObject(oldObj);
+
+            //Create an input stream from which to deserialize the object
+            byte[] byteArray = ostream.toByteArray();
+            ByteArrayInputStream istream = new ByteArrayInputStream(byteArray);
+            ObjectInputStream q = new ObjectInputStream(istream);
+            //Deserialize the object
+            newObj = q.readObject();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return newObj;
+    }
+
+    public static void main(String[] args) {
+        ReadObject myHashtable = new ReadObject();
+        myHashtable.put("key", "value");
+        ReadObject myHashtableCopy = (ReadObject)copyObject(myHashtable);
+        String value = (String)myHashtableCopy.get("key");
+    }
+};
diff --git a/test/java/util/Hashtable/SelfRef.java b/test/java/util/Hashtable/SelfRef.java
new file mode 100644
index 0000000..ff3423b
--- /dev/null
+++ b/test/java/util/Hashtable/SelfRef.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2001-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 4421469 6282555
+ * @summary Hashtable's toString method should detect self-referential
+ *          hash tables rather than throwing a StackOverflowException.
+ * @author Josh Bloch, Martin Buchholz
+ */
+
+import java.util.*;
+import java.util.concurrent.*;
+
+public class SelfRef {
+    public static void main(String[] args) {
+        testMap(new Hashtable<Object,Object>());
+        testMap(new HashMap<Object,Object>());
+        testMap(new LinkedHashMap<Object,Object>());
+        testMap(new ConcurrentHashMap<Object,Object>());
+    }
+
+    private static void testMap(Map<Object,Object> m) {
+        if (! (m.toString().equals("{}")))
+            throw new Error();
+        m.put("Harvey", m);
+        if (! (m.toString().equals("{Harvey=(this Map)}")))
+            throw new Error();
+        m.clear();
+        m.put(m, "Harvey");
+        if (! (m.toString().equals("{(this Map)=Harvey}")))
+            throw new Error();
+        m.clear();
+        m.hashCode();
+    }
+}