Initial load
diff --git a/test/java/lang/ClassLoader/Assert.java b/test/java/lang/ClassLoader/Assert.java
new file mode 100644
index 0000000..33d3c09
--- /dev/null
+++ b/test/java/lang/ClassLoader/Assert.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2000-2002 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 4290640 4785473
+ * @run shell/timeout=300 Assert.sh
+ * @summary Test the assertion facility
+ * @author Mike McCloskey
+ */
+
+import package1.*;
+import package2.*;
+import package1.package3.*;
+import java.io.*;
+import java.util.Random;
+
+public class Assert {
+
+    private static Class1 testClass1;
+    private static Class2 testClass2;
+    private static Class3 testClass3;
+    private static final  boolean debug = false;
+    private static Random generator = new Random();
+
+    /**
+     * The first invocation of this test starts a loop which exhaustively tests
+     * the object tree with all of its different settings.
+     * There are 7 test objects in a tree that has 7 different places to set
+     * assertions untouched/on/off so this tests 3^7 or 2187 different
+     * configurations.
+     *
+     * This test spawns a new VM for each run because assertions are set on or
+     * off at class load time. Once the class is loaded its assertion status
+     * does not change.
+     */
+    public static void main(String[] args) throws Exception {
+
+        // Switch values: 0=don't touch, 1=off, 2 = on
+        int[] switches = new int[7];
+
+        int switchSource = 0;
+        if (args.length == 0) { // This is master version
+
+            // This code is for an exhaustive test
+            //while(switchSource < 2187) {
+            //    int temp = switchSource++;
+
+            // This code is for a weaker but faster test
+            for(int x=0; x<100; x++) {
+                int temp = generator.nextInt(2187);
+                for(int i=0; i<7; i++) {
+                    switches[i] = temp % 3;
+                    temp = temp / 3;
+                }
+
+                // Spawn new VM and load classes
+                String command = System.getProperty("java.home") +
+                    File.separator + "bin" + File.separator + "java Assert";
+
+                StringBuffer commandString = new StringBuffer(command);
+                for(int j=0; j<7; j++)
+                    commandString.append(" "+switches[j]);
+
+                Process p = null;
+                p = Runtime.getRuntime().exec(commandString.toString());
+
+                if (debug) { // See output of test VMs
+                    BufferedReader blah = new BufferedReader(
+                                          new InputStreamReader(p.getInputStream()));
+                    String outString = blah.readLine();
+                    while (outString != null) {
+                        System.out.println("from slave:"+outString);
+                        outString = blah.readLine();
+                    }
+                }
+
+                p.waitFor();
+                int result = p.exitValue();
+                if (debug) { // See which switch configs failed
+                    if (result == 0) {
+                        for(int k=6; k>=0; k--)
+                            System.out.print(switches[k]);
+                        System.out.println();
+                    } else {
+                        System.out.print("Nonzero Exit: ");
+                        for(int k=6; k>=0; k--)
+                            System.out.print(switches[k]);
+                        System.out.println();
+                    }
+                } else {
+                    if (result != 0) {
+                        System.err.print("Nonzero Exit: ");
+                        for(int k=6; k>=0; k--)
+                            System.err.print(switches[k]);
+                        System.err.println();
+                        throw new RuntimeException("Assertion test failure.");
+                    }
+                }
+            }
+        } else { // This is a test spawn
+            for(int i=0; i<7; i++)
+                switches[i] = Integer.parseInt(args[i]);
+
+            SetAssertionSwitches(switches);
+            ConstructClassTree();
+            TestClassTree(switches);
+        }
+    }
+
+    /*
+     * Activate/Deactivate the assertions in the tree according to the
+     * specified switches.
+     */
+    private static void SetAssertionSwitches(int[] switches) {
+        ClassLoader loader = ClassLoader.getSystemClassLoader();
+
+        if (switches[0] != 0)
+            loader.setDefaultAssertionStatus(switches[0]==2);
+        if (switches[1] != 0)
+            loader.setPackageAssertionStatus("package1", switches[1]==2);
+        if (switches[2] != 0)
+            loader.setPackageAssertionStatus("package2", switches[2]==2);
+        if (switches[3] != 0)
+            loader.setPackageAssertionStatus("package1.package3", switches[3]==2);
+        if (switches[4] != 0)
+            loader.setClassAssertionStatus("package1.Class1", switches[4]==2);
+        if (switches[5] != 0)
+            loader.setClassAssertionStatus("package2.Class2", switches[5]==2);
+        if (switches[6] != 0)
+            loader.setClassAssertionStatus("package1.package3.Class3", switches[6]==2);
+    }
+
+    /*
+     * Verify that the assertions are activated or deactivated as specified
+     * by the switches.
+     */
+    private static void TestClassTree(int[] switches) {
+
+        // Class1 and anonymous inner class
+        boolean assertsOn = (switches[4]==2) ? true : (switches[4]==1) ? false :
+            (switches[1]==2) ? true : (switches[1]==1) ? false : (switches[0]==2) ?
+            true: false;
+        testClass1.testAssert(assertsOn);
+
+        // Class1 inner class Class11
+        assertsOn = (switches[4]==2) ? true : (switches[4]==1) ? false :
+            (switches[1]==2) ? true : (switches[1]==1) ? false : (switches[0]==2) ?
+            true: false;
+        Class1.Class11.testAssert(assertsOn);
+
+        // Class2
+        assertsOn = (switches[5]==2) ? true : (switches[5]==1) ? false :
+            (switches[2]==2) ? true : (switches[2]==1) ? false : (switches[0]==2) ?
+            true: false;
+        testClass2.testAssert(assertsOn);
+
+        // Class3 and anonymous inner class
+        assertsOn = (switches[6]==2) ? true : (switches[6]==1) ? false :
+                    (switches[3]==2) ? true : (switches[3]==1) ? false :
+                    (switches[1]==2) ? true : (switches[1]==1) ? false :
+                    (switches[0]==2) ? true: false;
+        testClass3.testAssert(assertsOn);
+
+        // Class3 inner class Class31
+        assertsOn = (switches[6]==2) ? true : (switches[6]==1) ? false :
+                    (switches[3]==2) ? true : (switches[3]==1) ? false :
+                    (switches[1]==2) ? true : (switches[1]==1) ? false :
+                    (switches[0]==2) ? true : false;
+        Class3.Class31.testAssert(assertsOn);
+
+    }
+
+    /*
+     * Create the class tree to be tested. Each test run must reload the classes
+     * of the tree since assertion status is determined at class load time.
+     */
+    private static void ConstructClassTree() {
+        testClass1 = new Class1();
+        testClass2 = new Class2();
+        testClass3 = new Class3();
+    }
+
+
+}
diff --git a/test/java/lang/ClassLoader/Assert.sh b/test/java/lang/ClassLoader/Assert.sh
new file mode 100644
index 0000000..4744def
--- /dev/null
+++ b/test/java/lang/ClassLoader/Assert.sh
@@ -0,0 +1,63 @@
+#
+# Copyright 2001-2002 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.
+#
+
+#
+
+if [ "${TESTSRC}" = "" ]
+then
+  echo "TESTSRC not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+echo "TESTSRC=${TESTSRC}"
+if [ "${TESTJAVA}" = "" ]
+then
+  echo "TESTJAVA not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+echo "TESTJAVA=${TESTJAVA}"
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+echo "TESTCLASSES=${TESTCLASSES}"
+echo "CLASSPATH=${CLASSPATH}"
+
+cp ${TESTSRC}/Assert.java .
+cp -R ${TESTSRC}/package1 .
+cp -R ${TESTSRC}/package2 .
+
+${TESTJAVA}/bin/javac -source 1.4 Assert.java 
+
+${TESTJAVA}/bin/java Assert
+
+result=$?
+if [ $result -eq 0 ]
+then
+  echo "Passed"
+else
+  echo "Failed"
+fi
+exit $result
+
+
diff --git a/test/java/lang/ClassLoader/ExceptionHidingLoader.java b/test/java/lang/ClassLoader/ExceptionHidingLoader.java
new file mode 100644
index 0000000..c6d1f87
--- /dev/null
+++ b/test/java/lang/ClassLoader/ExceptionHidingLoader.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 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 4135104
+   @summary If a badly behaved ClassLoader returns null but doesn't
+            raise an exception, the VM core dumps.
+*/
+
+
+public class ExceptionHidingLoader extends ClassLoader {
+
+    protected Class findClass(String name) throws ClassNotFoundException {
+        return null;
+    }
+
+    public static void main(String[] args) throws Exception {
+        boolean exception = false;
+
+        try {
+            Class.forName("aha", false, new ExceptionHidingLoader());
+        } catch (ClassNotFoundException e) {
+            /* VM was smart enough to detect the problem and raise an
+               exception. */
+            exception = true;
+        }
+        if (!exception) {
+            throw new Exception("Bogus loader behavior not being corrected");
+        }
+    }
+
+}
diff --git a/test/java/lang/ClassLoader/GetDotResource.java b/test/java/lang/ClassLoader/GetDotResource.java
new file mode 100644
index 0000000..cd2217b
--- /dev/null
+++ b/test/java/lang/ClassLoader/GetDotResource.java
@@ -0,0 +1,44 @@
+/*
+ * 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 4273031
+ * @summary ClassLoader.getResouce() should be able to
+ *          find resources with leading "." in their names
+ * @build GetDotResource
+ * @run shell getdotresource.sh
+ */
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+
+public class GetDotResource {
+    public static void main(String[] args) throws Exception {
+        if (GetDotResource.class.getClassLoader().
+            getResourceAsStream(".resource") == null)
+            throw new Exception("Could not find resource with " +
+                                "leading . in their names");
+    }
+}
diff --git a/test/java/lang/ClassLoader/GetPackage.java b/test/java/lang/ClassLoader/GetPackage.java
new file mode 100644
index 0000000..2c777cd
--- /dev/null
+++ b/test/java/lang/ClassLoader/GetPackage.java
@@ -0,0 +1,68 @@
+/*
+ * 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 4256589
+ * @summary Test if getPackage() and getPackages()
+ *          return consistent values.
+ */
+
+public class GetPackage {
+    public static void main(String arg[]) throws Exception {
+        TestClassLoader parent = new TestClassLoader();
+        TestClassLoader child = new TestClassLoader(parent);
+        // child define a package first
+        child.defineEmptyPackage("foo");
+        // parent then define another package with the same name
+        parent.defineEmptyPackage("foo");
+        if (!child.testPackageView("foo"))
+            throw new Exception("Inconsistent packages view");
+    }
+}
+
+class TestClassLoader extends ClassLoader {
+    public TestClassLoader() {
+        super();
+    }
+
+    public TestClassLoader(ClassLoader parent) {
+        super(parent);
+    }
+
+    public Package defineEmptyPackage(String name) {
+        return definePackage(name, null, null, null, null, null, null, null);
+    }
+
+    /* test to see if getPackage() and getPackages()
+     * are consistent.
+     */
+    public boolean testPackageView(String name) {
+        Package[] pkgs = getPackages();
+        Package pkg = getPackage(name);
+        for(int i = 0; i < pkgs.length; i++)
+            if (pkgs[i].getName().equals(name) && pkgs[i] == pkg)
+                return true;
+        return false;
+    }
+}
diff --git a/test/java/lang/ClassLoader/LoadNullClass.java b/test/java/lang/ClassLoader/LoadNullClass.java
new file mode 100644
index 0000000..9073a71
--- /dev/null
+++ b/test/java/lang/ClassLoader/LoadNullClass.java
@@ -0,0 +1,55 @@
+/*
+ * 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 4263588 4292814
+ * @summary ClassLoader.loadClass() should not core dump
+ *          on null class names.
+ */
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+
+public class LoadNullClass {
+    public static void main(String[] args) throws Exception {
+        File f = new File(System.getProperty("test.src", "."));
+        // give the class loader a good but useless url
+        FileClassLoader cl = new FileClassLoader
+            (new URL[]{new URL("file:"+ f.getAbsolutePath())});
+        cl.testFindLoadedClass(null);
+    }
+}
+
+class FileClassLoader extends URLClassLoader {
+
+    public FileClassLoader(URL[] urls) {
+        super(urls);
+    }
+
+    public void testFindLoadedClass(String name) throws Exception {
+        super.findLoadedClass(name);
+    }
+}
diff --git a/test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java b/test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java
new file mode 100644
index 0000000..1200985
--- /dev/null
+++ b/test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java
@@ -0,0 +1,126 @@
+/*
+ * 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 4894899
+ * @summary Test various cases of passing java.nio.ByteBuffers
+ * to defineClass().
+ *
+ * @build DefineClassByteBuffer TestClass
+ * @run main DefineClassByteBuffer
+ */
+
+import java.nio.*;
+import java.nio.channels.*;
+import java.io.*;
+
+public class DefineClassByteBuffer {
+
+    static void test(ClassLoader cl) throws Exception {
+        Class c = Class.forName("TestClass", true, cl);
+        if (!"TestClass".equals(c.getName())) {
+            throw new RuntimeException("Got wrong class: " + c);
+        }
+    }
+
+    public static void main(String arg[]) throws Exception {
+        ClassLoader[] cls = new ClassLoader[DummyClassLoader.MAX_TYPE];
+        for (int i = 0; i < cls.length; i++) {
+            cls[i] = new DummyClassLoader(i);
+        }
+
+        /* Create several instances of the class using different classloaders,
+           which are using different types of ByteBuffer. */
+        for (int i = 0; i < cls.length; i++) {
+          test(cls[i]);
+        }
+    }
+
+    /** Always loads the same class, using various types of ByteBuffers */
+    public static class DummyClassLoader extends ClassLoader {
+
+        public static final String CLASS_NAME = "TestClass";
+
+        public static final int MAPPED_BUFFER = 0;
+        public static final int DIRECT_BUFFER = 1;
+        public static final int ARRAY_BUFFER = 2;
+        public static final int WRAPPED_BUFFER = 3;
+        public static final int READ_ONLY_ARRAY_BUFFER = 4;
+        public static final int READ_ONLY_DIRECT_BUFFER = 5;
+        public static final int DUP_ARRAY_BUFFER = 6;
+        public static final int DUP_DIRECT_BUFFER = 7;
+        public static final int MAX_TYPE = 7;
+
+        int loaderType;
+
+        DummyClassLoader(int loaderType) {
+            this.loaderType = loaderType;
+        }
+
+        static ByteBuffer[] buffers = new ByteBuffer[MAX_TYPE + 1];
+
+        static ByteBuffer readClassFile(String name) {
+            try {
+                File f = new File(System.getProperty("test.classes", "."),
+                                  name);
+                FileInputStream fin = new FileInputStream(f);
+                FileChannel fc = fin.getChannel();
+                return fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+            } catch (FileNotFoundException e) {
+                throw new RuntimeException("Can't open file: " + name, e);
+            } catch (IOException e) {
+                throw new RuntimeException("Can't open file: " + name, e);
+            }
+        }
+
+        static {
+            /* create a bunch of different ByteBuffers, starting with a mapped
+               buffer from a class file, and create various duplicate and wrapped
+               buffers. */
+            buffers[MAPPED_BUFFER] = readClassFile(CLASS_NAME + ".class");
+            byte[] array = new byte[buffers[MAPPED_BUFFER].limit()];
+
+            buffers[DIRECT_BUFFER] = ByteBuffer.allocateDirect(array.length);
+            buffers[DIRECT_BUFFER].put(array);
+
+            buffers[ARRAY_BUFFER] = ByteBuffer.allocate(array.length);
+            buffers[ARRAY_BUFFER].put(array);
+
+            buffers[WRAPPED_BUFFER] = ByteBuffer.wrap(array);
+
+            buffers[READ_ONLY_ARRAY_BUFFER] = buffers[ARRAY_BUFFER].asReadOnlyBuffer();
+
+            buffers[READ_ONLY_DIRECT_BUFFER] = buffers[DIRECT_BUFFER].asReadOnlyBuffer();
+
+            buffers[DUP_ARRAY_BUFFER] = buffers[ARRAY_BUFFER].duplicate();
+
+            buffers[DUP_DIRECT_BUFFER] = buffers[DIRECT_BUFFER].duplicate();
+        }
+
+         public Class findClass(String name) {
+             return defineClass(name, buffers[loaderType], null);
+         }
+    } /* DummyClassLoader */
+
+} /* DefineClassByteBuffer */
diff --git a/test/java/lang/ClassLoader/defineClass/TestClass.java b/test/java/lang/ClassLoader/defineClass/TestClass.java
new file mode 100644
index 0000000..9e93d3c
--- /dev/null
+++ b/test/java/lang/ClassLoader/defineClass/TestClass.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+public class TestClass {
+    public static String foo() {
+        return "OK";
+    }
+}
diff --git a/test/java/lang/ClassLoader/findSystemClass/Loadee.classfile b/test/java/lang/ClassLoader/findSystemClass/Loadee.classfile
new file mode 100644
index 0000000..b98aaa7
--- /dev/null
+++ b/test/java/lang/ClassLoader/findSystemClass/Loadee.classfile
Binary files differ
diff --git a/test/java/lang/ClassLoader/findSystemClass/Loadee.java b/test/java/lang/ClassLoader/findSystemClass/Loadee.java
new file mode 100644
index 0000000..4ece146
--- /dev/null
+++ b/test/java/lang/ClassLoader/findSystemClass/Loadee.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 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.
+ */
+
+public class Loadee {
+    Loader app;
+    public Loadee() {
+        app = new Loader();
+    }
+}
diff --git a/test/java/lang/ClassLoader/findSystemClass/Loadee.resource b/test/java/lang/ClassLoader/findSystemClass/Loadee.resource
new file mode 100644
index 0000000..9a60964
--- /dev/null
+++ b/test/java/lang/ClassLoader/findSystemClass/Loadee.resource
@@ -0,0 +1,2 @@
+It really doesn't matter what is in this file, so long as this file is
+there.
diff --git a/test/java/lang/ClassLoader/findSystemClass/Loader.java b/test/java/lang/ClassLoader/findSystemClass/Loader.java
new file mode 100644
index 0000000..e84a9c2
--- /dev/null
+++ b/test/java/lang/ClassLoader/findSystemClass/Loader.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright 1998-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 4147599 4478150
+   @summary In 1.2beta4-I ClassLoader loaded classes can not link
+            against application classes.
+*/
+
+/*
+ * We are trying to test that certain methods of ClassLoader look at the same
+ * paths as they did in 1.1.  To run this test on 1.1, you will have to pass
+ * "-1.1" as option on the command line.
+ *
+ * The required files are:
+ *
+ *      - Loader.java            (a 1.1 style class loader)
+ *      - Loadee.java            (source for a class that refers to Loader)
+ *      - Loadee.classfile       (to test findSystemClass)
+ *      - Loadee.resource        (to test getSystemResource)
+ *      - java/lang/Object.class (to test getSystemResources)
+ *
+ * The extension ".classfile" is so the class file is not seen by any loader
+ * other than Loader.  If you need to make any changes you will have to
+ * compile Loadee.java and rename Loadee.class to Loadee.classfile.
+ */
+
+import java.io.File;
+import java.io.DataInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashSet;
+
+
+/**
+ * A 1.1-style ClassLoader.  The only class it can really load is "Loadee".
+ * For other classes it might be asked to load, it relies on loaders set up by
+ * the launcher.
+ */
+public class Loader extends ClassLoader {
+
+    public Class loadClass(String name, boolean resolve)
+        throws ClassNotFoundException {
+        Class c = null;
+        try {
+            c = findSystemClass(name);
+        } catch (ClassNotFoundException cnfe) {
+        }
+        if (c == null) {
+            if (!name.equals("Loadee"))
+                throw new Error("java.lang.ClassLoader.findSystemClass() " +
+                                "did not find class " + name);
+            byte[] b = locateBytes();
+            c = defineClass(name, b, 0, b.length);
+        }
+        if (resolve) {
+            resolveClass(c);
+        }
+        return c;
+    }
+
+    private byte[] locateBytes() {
+        try {
+            File f   = new File(System.getProperty("test.src", "."),
+                                "Loadee.classfile");
+            long l   = f.length();
+            byte[] b = new byte[(int)l];
+            DataInputStream in =
+                new DataInputStream(new FileInputStream(f));
+            in.readFully(b);
+            return b;
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+            throw new Error("Test failed due to IOException!");
+        }
+    }
+
+    private static final int FIND      = 0x1;
+    private static final int RESOURCE  = 0x2;
+    private static final int RESOURCES = 0x4;
+
+    public static void main(String[] args) throws Exception {
+        int tests = FIND | RESOURCE | RESOURCES;
+
+        if (args.length == 1 && args[0].equals("-1.1")) {
+            tests &= ~RESOURCES; /* Do not run getResources test. */
+        }
+
+        if ((tests & FIND) == FIND) {
+            report("findSystemClass()");
+            ClassLoader l = new Loader();
+            Class       c = l.loadClass("Loadee");
+            Object      o = c.newInstance();
+        }
+
+        if ((tests & RESOURCE) == RESOURCE) {
+            report("getSystemResource()");
+            URL u = getSystemResource("Loadee.resource");
+            if (u == null)
+                throw new Exception
+                    ("java.lang.ClassLoader.getSystemResource() test failed!");
+        }
+
+        if ((tests & RESOURCES) == RESOURCES) {
+            report("getSystemResources()");
+            java.util.Enumeration e =
+                getSystemResources("java/lang/Object.class");
+            HashSet hs = new HashSet();
+            while (e.hasMoreElements()) {
+                URL u = (URL)e.nextElement();
+                if (u == null)
+                    break;
+                System.out.println("url: " + u);
+                hs.add(u);
+            }
+            if (hs.size() != 2) {
+                throw
+                    new Exception("java.lang.ClassLoader.getSystemResources()"+
+                                  " did not find all resources");
+            }
+        }
+    }
+
+    private static void report(String s) {
+        System.out.println("Testing java.lang.ClassLoader." + s + " ...");
+    }
+}
diff --git a/test/java/lang/ClassLoader/findSystemClass/java/lang/Object.class b/test/java/lang/ClassLoader/findSystemClass/java/lang/Object.class
new file mode 100644
index 0000000..0549a31
--- /dev/null
+++ b/test/java/lang/ClassLoader/findSystemClass/java/lang/Object.class
@@ -0,0 +1 @@
+Fake resource, to test the getResources() variant.
diff --git a/test/java/lang/ClassLoader/getdotresource.sh b/test/java/lang/ClassLoader/getdotresource.sh
new file mode 100644
index 0000000..e8ba854
--- /dev/null
+++ b/test/java/lang/ClassLoader/getdotresource.sh
@@ -0,0 +1,36 @@
+#! /bin/sh
+
+#
+# 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.
+#
+
+#
+
+if [ x"$TESTJAVA" = x ]; then 
+        TESTJAVA=$1 
+        shift 
+fi
+if [ x"$TESTCLASSES" = x ]; then TESTCLASSES=.; fi
+if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi
+
+# now start the test
+${TESTJAVA}/bin/java -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetDotResource
\ No newline at end of file
diff --git a/test/java/lang/ClassLoader/package1/Class1.java b/test/java/lang/ClassLoader/package1/Class1.java
new file mode 100644
index 0000000..69205a2
--- /dev/null
+++ b/test/java/lang/ClassLoader/package1/Class1.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000 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.
+ */
+
+package package1;
+
+public class Class1 {
+    public void testAssert(boolean assertsShouldBeOn) {
+        boolean assertsEnabled = false;
+        assert assertsEnabled = true;
+        if (assertsEnabled != assertsShouldBeOn)
+            throw new RuntimeException("Failure of Asserts Facility.");
+
+        Class1 anonTest =  new Class1() {
+            public void testAssert(boolean assertsShouldBeOn) {
+                boolean assertsEnabled2 = false;
+                assert assertsEnabled2 = true;
+                if (assertsEnabled2 != assertsShouldBeOn)
+                    throw new RuntimeException("Failure of Asserts Facility.");
+            }
+        };
+        anonTest.testAssert(assertsShouldBeOn);
+    }
+
+    // Named inner class
+    public static class Class11 {
+        public static void testAssert(boolean assertsShouldBeOn) {
+            boolean assertsEnabled3 = false;
+            assert assertsEnabled3 = true;
+            if (assertsEnabled3 != assertsShouldBeOn)
+                throw new RuntimeException("Failure of Asserts Facility.");
+        }
+    }
+
+}
diff --git a/test/java/lang/ClassLoader/package1/package3/Class3.java b/test/java/lang/ClassLoader/package1/package3/Class3.java
new file mode 100644
index 0000000..64a8cc6
--- /dev/null
+++ b/test/java/lang/ClassLoader/package1/package3/Class3.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000 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.
+ */
+
+package package1.package3;
+
+public class Class3 {
+    public void testAssert(boolean assertsShouldBeOn) {
+        boolean assertsEnabled = false;
+        assert(assertsEnabled = true);
+        if (assertsEnabled != assertsShouldBeOn)
+            throw new RuntimeException("Failure of Asserts Facility.");
+
+        Class3 anonTest =  new Class3() {
+            public void testAssert(boolean assertsShouldBeOn) {
+                boolean assertsEnabled = false;
+                assert(assertsEnabled = true);
+                if (assertsEnabled != assertsShouldBeOn)
+                    throw new RuntimeException("Failure of Asserts Facility.");
+            }
+        };
+        anonTest.testAssert(assertsShouldBeOn);
+    }
+
+    // Named inner class
+    public static class Class31 {
+        public static void testAssert(boolean assertsShouldBeOn) {
+            boolean assertsEnabled = false;
+            assert(assertsEnabled = true);
+            if (assertsEnabled != assertsShouldBeOn)
+                throw new RuntimeException("Failure of Asserts Facility.");
+        }
+    }
+}
diff --git a/test/java/lang/ClassLoader/package2/Class2.java b/test/java/lang/ClassLoader/package2/Class2.java
new file mode 100644
index 0000000..7d459ec
--- /dev/null
+++ b/test/java/lang/ClassLoader/package2/Class2.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000 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.
+ */
+
+package package2;
+
+public class Class2 {
+    public void testAssert(boolean assertsShouldBeOn) {
+        boolean assertsEnabled = false;
+        assert(assertsEnabled = true);
+        if (assertsEnabled != assertsShouldBeOn)
+            throw new RuntimeException("Failure of Asserts Facility.");
+    }
+}
diff --git a/test/java/lang/ClassLoader/resource.jar b/test/java/lang/ClassLoader/resource.jar
new file mode 100644
index 0000000..6920016
--- /dev/null
+++ b/test/java/lang/ClassLoader/resource.jar
Binary files differ