Initial load
diff --git a/test/java/io/File/AccessDenied.java b/test/java/io/File/AccessDenied.java
new file mode 100644
index 0000000..66acd40
--- /dev/null
+++ b/test/java/io/File/AccessDenied.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2006 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 6198547
+ * @summary Test to ensure that File.createNewFile() consistently
+ *      returns the same (false) value when the specified path
+ *      is already present as a directory.
+ */
+
+import java.io.*;
+
+public class AccessDenied {
+    public static void main(String[] args)
+                throws Exception {
+        File dir = new File(System.getProperty("test.dir", "."),
+                         "hugo");
+        dir.deleteOnExit();
+        if (!dir.mkdir()) {
+            throw new Exception("Could not create directory:" + dir);
+        }
+        System.out.println("Created directory:" + dir);
+
+        File file = new File(System.getProperty("test.dir", "."), "hugo");
+        boolean result = file.createNewFile();
+        System.out.println("CreateNewFile() for:" + file + " returned:" +
+                        result);
+        if (result) {
+            throw new Exception(
+                "Expected createNewFile() to return false but it returned true");
+        }
+    }
+}
diff --git a/test/java/io/File/Basic.java b/test/java/io/File/Basic.java
new file mode 100644
index 0000000..a57c6cc
--- /dev/null
+++ b/test/java/io/File/Basic.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright 1998-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 4165666 4203706 4288670 4290024
+   @summary Basic heartbeat test for File methods that access the filesystem
+
+   @build Basic
+   @run shell basic.sh
+ */
+
+import java.io.IOException;
+import java.io.File;
+import java.io.PrintStream;
+import java.io.RandomAccessFile;
+
+
+public class Basic {
+
+    static PrintStream out = System.err;
+
+    static File nonExistantFile = new File("x.Basic.non");
+    static File rwFile = new File("x.Basic.rw");
+    static File bigFile = new File("x.Basic.big");
+    static File roFile = new File("x.Basic.ro");
+    static File thisDir = new File(".");
+    static File dir = new File("x.Basic.dir");
+    static File nonDir = new File("x.Basic.nonDir");
+
+    static void showBoolean(String what, boolean value) {
+        out.println("  " + what + ": " + value);
+    }
+
+    static void showLong(String what, long value) {
+        out.println("  " + what + ": " + value);
+    }
+
+    static void show(File f) throws Exception {
+        out.println(f + ": ");
+        showBoolean("exists", f.exists());
+        showBoolean("isFile", f.isFile());
+        showBoolean("isDirectory", f.isDirectory());
+        showBoolean("canRead", f.canRead());
+        showBoolean("canWrite", f.canWrite());
+        showLong("lastModified", f.lastModified());
+        showLong("length", f.length());
+    }
+
+    static void testFile(File f, boolean writeable, long length)
+        throws Exception
+    {
+        if (!f.exists()) fail(f, "does not exist");
+        if (!f.isFile()) fail(f, "is not a file");
+        if (f.isDirectory()) fail(f, "is a directory");
+        if (!f.canRead()) fail(f, "is not readable");
+        if (f.canWrite() != writeable)
+            fail(f, writeable ? "is not writeable" : "is writeable");
+        int rwLen = (File.separatorChar == '/' ? 6 : 7);
+        if (f.length() != length) fail(f, "has wrong length");
+    }
+
+    static void fail(File f, String why) throws Exception {
+        throw new Exception(f + " " + why);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        show(nonExistantFile);
+        if (nonExistantFile.exists()) fail(nonExistantFile, "exists");
+
+        show(rwFile);
+        testFile(rwFile, true, File.separatorChar == '/' ? 6 : 7);
+        rwFile.delete();
+        if (rwFile.exists())
+            fail(rwFile, "could not delete");
+
+        show(roFile);
+        testFile(roFile, false, 0);
+
+        show(thisDir);
+        if (!thisDir.exists()) fail(thisDir, "does not exist");
+        if (thisDir.isFile()) fail(thisDir, "is a file");
+        if (!thisDir.isDirectory()) fail(thisDir, "is not a directory");
+        if (!thisDir.canRead()) fail(thisDir, "is readable");
+        if (!thisDir.canWrite()) fail(thisDir, "is writeable");
+        String[] fs = thisDir.list();
+        if (fs == null) fail(thisDir, "list() returned null");
+        out.print("  [" + fs.length + "]");
+        for (int i = 0; i < fs.length; i++)
+            out.print(" " + fs[i]);
+        out.println();
+        if (fs.length == 0) fail(thisDir, "is empty");
+
+        if (!nonExistantFile.createNewFile())
+            fail(nonExistantFile, "could not create");
+        nonExistantFile.deleteOnExit();
+
+        if (!nonDir.mkdir())
+            fail(nonDir, "could not create");
+
+        if (!dir.renameTo(new File("x.Basic.dir2")))
+            fail(dir, "failed to rename");
+
+        if (System.getProperty("os.name").equals("SunOS")
+            && System.getProperty("os.version").compareTo("5.6") >= 0) {
+            if (bigFile.exists()) {
+                bigFile.delete();
+                if (bigFile.exists())
+                    fail(bigFile, "could not delete");
+            }
+            RandomAccessFile raf = new RandomAccessFile(bigFile, "rw");
+            long big = ((long)Integer.MAX_VALUE) * 2;
+            try {
+                raf.seek(big);
+                raf.write('x');
+                show(bigFile);
+                testFile(bigFile, true, big + 1);
+            } finally {
+                raf.close();
+            }
+            bigFile.delete();
+            if (bigFile.exists())
+                fail(bigFile, "could not delete");
+        } else {
+            System.err.println("NOTE: Large files not supported on this system");
+        }
+
+    }
+
+}
diff --git a/test/java/io/File/BlockIsDirectory.java b/test/java/io/File/BlockIsDirectory.java
new file mode 100644
index 0000000..42c3b2a
--- /dev/null
+++ b/test/java/io/File/BlockIsDirectory.java
@@ -0,0 +1,63 @@
+/*
+ * 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 4113217
+   @summary Test File.isDirectory on block device
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class BlockIsDirectory {
+    public static void main( String args[] ) throws Exception {
+        String osname = System.getProperty("os.name");
+        if (osname.equals("SunOS")) {
+            File dir = new File("/dev/dsk");
+            String dirList[] = dir.list();
+
+            File aFile = new File( "/dev/dsk/" + dirList[0] );
+
+            boolean result = aFile.isDirectory();
+            if (result == true)
+                throw new RuntimeException(
+                    "IsDirectory returns true for block device.");
+        }
+        if (osname.equals("Linux")) {
+            File dir = new File("/dev/ide0");
+            if (dir.exists()) {
+                boolean result = dir.isDirectory();
+                if (result == true)
+                    throw new RuntimeException(
+                        "IsDirectory returns true for block device.");
+            }
+            dir = new File("/dev/scd0");
+            if (dir.exists()) {
+                boolean result = dir.isDirectory();
+                if (result == true)
+                    throw new RuntimeException(
+                        "IsDirectory returns true for block device.");
+            }
+        }
+    }
+}
diff --git a/test/java/io/File/CheckTempDir.java b/test/java/io/File/CheckTempDir.java
new file mode 100644
index 0000000..7c45c41
--- /dev/null
+++ b/test/java/io/File/CheckTempDir.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 1997 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 4099970
+ *
+ * @summary this tests that the temp dir variable, java.io.tmpdir is
+ * properly initialized.
+ *
+ * @author Benjamin Renaud
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+public class CheckTempDir {
+
+    public static void main (String[] args) {
+        String tmpdir = null;
+        if ((tmpdir = System.getProperty("java.io.tmpdir")) == null) {
+            throw new RuntimeException("java.io.tmpdir is not initialized");
+        } else {
+            System.out.println("checked tmpdir is not null: " + tmpdir);
+        }
+    }
+}
diff --git a/test/java/io/File/CompareTo.java b/test/java/io/File/CompareTo.java
new file mode 100644
index 0000000..299d266
--- /dev/null
+++ b/test/java/io/File/CompareTo.java
@@ -0,0 +1,53 @@
+/*
+ * 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 4131169
+   @summary Test respecified compareTo method
+ */
+
+import java.io.*;
+
+
+public class CompareTo {
+
+    private static void testWin32() throws Exception {
+        File f1 = new File("a");
+        File f2 = new File("B");
+        if (!(f1.compareTo(f2) < 0))
+            throw new Exception("compareTo incorrect");
+    }
+
+    private static void testUnix() throws Exception {
+        File f1 = new File("a");
+        File f2 = new File("B");
+        if (!(f1.compareTo(f2) > 0))
+            throw new Exception("compareTo incorrect");
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (File.separatorChar == '\\') testWin32();
+        if (File.separatorChar == '/') testUnix();
+    }
+
+}
diff --git a/test/java/io/File/Cons.java b/test/java/io/File/Cons.java
new file mode 100644
index 0000000..7dc9bf8
--- /dev/null
+++ b/test/java/io/File/Cons.java
@@ -0,0 +1,315 @@
+/*
+ * 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 4131169 4168988
+   @summary Basic File constructor tests
+ */
+
+
+import java.io.*;
+import java.util.ArrayList;
+
+
+public class Cons {
+
+    private static boolean debug = false;
+    private static boolean old = false;
+    private static boolean win32 = (File.separatorChar == '\\');
+
+
+    private static String cvt(String s) {
+        if (s == null) return s;
+        if (win32) return s.replace('/', '\\');
+        return s;
+    }
+
+    private static String[] slashPerms(String s) {
+        if (!win32) return new String[] { s };
+        if (s == null) return new String[] { s };
+        int i = s.indexOf('/');
+        if (i < 0) return new String[] { s };
+        ArrayList a = new ArrayList();
+        String p1 = s.substring(0, i);
+        String[] p2 = slashPerms(s.substring(i + 1));
+        for (int j = 0; j < p2.length; j++)
+            a.add(p1 + '/' + p2[j]);
+        for (int j = 0; j < p2.length; j++)
+            a.add(p1 + '\\' + p2[j]);
+        return (String[])(a.toArray(new String[a.size()]));
+    }
+
+
+    static class F extends File {
+        String exp;
+
+        public F(String path) {
+            super(path);
+            this.exp = cons(path);
+        }
+
+        public F(String parent, String child) {
+            super(parent, child);
+            this.exp = cons(parent, child);
+        }
+
+        public F(F parent, String child) {
+            super(parent, child);
+            if (parent == null) this.exp = cons((String)null, child);
+            else this.exp = cons(parent, child);
+        }
+
+    }
+
+
+    private static String nos(String s) {
+        if (s == null) return "null";
+        else return "\"" + s + "\"";
+    }
+
+    private static void ok(String ans, String exp) {
+        System.err.println(nos(ans) + " <== " + exp);
+    }
+
+    private static void err(String ans, String exp, String got) throws Exception {
+        System.err.println(nos(ans) + " <-- " + exp + " ==> " + nos(got));
+        if (!debug) {
+            throw new Exception("Mismatch: " + exp + " ==> " + nos(got)
+                                + ", should be " + nos(ans));
+        }
+    }
+
+    private static void ck(String ans, String exp, String got)
+        throws Exception
+    {
+        if ((got == ans) || ((got != null) && got.equals(ans))) ok(ans, exp);
+        else err(ans, exp, got);
+    }
+
+    private static String cons(String arg) {
+        return "new File(" + nos(arg) + ")";
+    }
+
+    private static String cons(String arg1, String arg2) {
+        return "new File(" + nos(arg1) + ", " + nos(arg2) + ")";
+    }
+
+    private static String cons(F arg1, String arg2) {
+        return "new File(" + arg1.exp + ", " + nos(arg2) + ")";
+    }
+
+    private static String op(String exp, String opname) {
+        return exp + "." + opname + "()";
+    }
+
+    private static void ckpnp(F f,
+                              String parent, String name, String path)
+        throws Exception
+    {
+        ck(cvt(path), op(f.exp, "getPath"), f.getPath());
+        ck(cvt(parent), op(f.exp, "getParent"), f.getParent());
+        ck(cvt(name), op(f.exp, "getName"), f.getName());
+    }
+
+    private static void ck1(String arg,
+                            String parent, String name, String path)
+        throws Exception
+    {
+        String[] parg = slashPerms(arg);
+        for (int i = 0; i < parg.length; i++)
+            ckpnp(new F(parg[i]), parent, name, path);
+    }
+
+    private static void ck2(String arg1, String arg2,
+                            String parent, String name, String path)
+        throws Exception
+    {
+        String[] parg1 = slashPerms(arg1);
+        String[] parg2 = slashPerms(arg2);
+        for (int i = 0; i < parg1.length; i++)
+            for (int j = 0; j < parg2.length; j++)
+                ckpnp(new F(parg1[i], parg2[j]), parent, name, path);
+    }
+
+    private static void ck2f(String arg1, String arg2,
+                             String parent, String name, String path)
+        throws Exception
+    {
+        String[] parg1 = slashPerms(arg1);
+        String[] parg2 = slashPerms(arg2);
+        for (int i = 0; i < parg1.length; i++)
+            for (int j = 0; j < parg2.length; j++) {
+                F p = (parg1[i] == null) ? null : new F(parg1[i]);
+                ckpnp(new F(p, parg2[j]), parent, name, path);
+            }
+    }
+
+
+    static void testBoth() throws Exception {
+
+        /* Null/empty constructor cases */
+        ck1("", null, "", "");
+        ck2(null, "", null, "", "");
+        ck2("", "", null, "", "/"); /* ugh */
+        ck2f("", "", null, "", "/");
+        if (!old) {
+            /* throws NullPointerException */
+            ck2f(null, "", null, "", "");
+        }
+
+        /* Separators-in-pathnames cases */
+        ck1("/", null, "", "/");
+        ck2f("/", "", null, "", "/");
+
+        /* One-arg constructor cases */
+        ck1("foo", null, "foo", "foo");
+        ck1("/foo", "/", "foo", "/foo");
+        ck1("/foo/bar", "/foo", "bar", "/foo/bar");
+        ck1("foo/bar", "foo", "bar", "foo/bar");
+        if (!old) {
+            ck1("foo/", null, "foo", "foo");
+            ck1("/foo/", "/", "foo", "/foo");
+            ck1("/foo//", "/", "foo", "/foo");
+            ck1("/foo///", "/", "foo", "/foo");
+            ck1("/foo//bar", "/foo", "bar", "/foo/bar");
+            ck1("/foo/bar//", "/foo", "bar", "/foo/bar");
+            ck1("foo//bar", "foo", "bar", "foo/bar");
+            ck1("foo/bar/", "foo", "bar", "foo/bar");
+            ck1("foo/bar//", "foo", "bar", "foo/bar");
+        }
+
+        /* Two-arg constructor cases, string parent */
+        ck2("foo", "bar", "foo", "bar", "foo/bar");
+        ck2("foo/", "bar", "foo", "bar", "foo/bar");
+        ck2("/foo", "bar", "/foo", "bar", "/foo/bar");
+        ck2("/foo/", "bar", "/foo", "bar", "/foo/bar");
+        if (!old) {
+            ck2("foo//", "bar", "foo", "bar", "foo/bar");
+            ck2("foo", "bar/", "foo", "bar", "foo/bar");
+            ck2("foo", "bar//", "foo", "bar", "foo/bar");
+            ck2("/foo//", "bar", "/foo", "bar", "/foo/bar");
+            ck2("/foo", "bar/", "/foo", "bar", "/foo/bar");
+            ck2("/foo", "bar//", "/foo", "bar", "/foo/bar");
+            ck2("foo", "/bar", "foo", "bar", "foo/bar");
+            ck2("foo", "//bar", "foo", "bar", "foo/bar");
+            ck2("/", "bar", "/", "bar", "/bar");
+            ck2("/", "/bar", "/", "bar", "/bar");
+        }
+
+        /* Two-arg constructor cases, File parent */
+        ck2f("foo", "bar", "foo", "bar", "foo/bar");
+        ck2f("foo/", "bar", "foo", "bar", "foo/bar");
+        ck2f("/foo", "bar", "/foo", "bar", "/foo/bar");
+        ck2f("/foo/", "bar", "/foo", "bar", "/foo/bar");
+        if (!old) {
+            ck2f("foo//", "bar", "foo", "bar", "foo/bar");
+            ck2f("foo", "bar/", "foo", "bar", "foo/bar");
+            ck2f("foo", "bar//", "foo", "bar", "foo/bar");
+            ck2f("/foo//", "bar", "/foo", "bar", "/foo/bar");
+            ck2f("/foo", "bar/", "/foo", "bar", "/foo/bar");
+            ck2f("/foo", "bar//", "/foo", "bar", "/foo/bar");
+            ck2f("foo", "/bar", "foo", "bar", "foo/bar");
+            ck2f("foo", "//bar", "foo", "bar", "foo/bar");
+        }
+    }
+
+
+    static void testUnix() throws Exception {
+
+        /* Separators-in-pathnames cases */
+        if (!old) {
+            ck1("//", null, "", "/");
+        }
+
+        /* One-arg constructor cases */
+        if (!old) {
+            ck1("//foo", "/", "foo", "/foo");
+            ck1("///foo", "/", "foo", "/foo");
+            ck1("//foo/bar", "/foo", "bar", "/foo/bar");
+        }
+
+        /* Two-arg constructors cases, string parent */
+        if (!old) {
+            ck2("//foo", "bar", "/foo", "bar", "/foo/bar");
+        }
+
+        /* Two-arg constructor cases, File parent */
+        if (!old) {
+            ck2f("//foo", "bar", "/foo", "bar", "/foo/bar");
+        }
+
+        File f = new File("/foo");
+        if (! f.isAbsolute()) throw new Exception(f + " should be absolute");
+
+        f = new File("foo");
+        if (f.isAbsolute()) throw new Exception(f + " should not be absolute");
+    }
+
+
+    static void testWin32() throws Exception {
+
+        if (!old) {
+            /* Separators-in-pathnames cases */
+            ck1("//", null, "", "//");
+
+            /* One-arg constructor cases */
+            ck1("//foo", "//", "foo", "//foo");
+            ck1("///foo", "//", "foo", "//foo");
+            ck1("//foo/bar", "//foo", "bar", "//foo/bar");
+
+            ck1("z:", null, "", "z:");
+            ck1("z:/", null, "", "z:/");
+            ck1("z://", null, "", "z:/");
+            ck1("z:/foo", "z:/", "foo", "z:/foo");
+            ck1("z:/foo/", "z:/", "foo", "z:/foo");
+            ck1("/z:/foo", "z:/", "foo", "z:/foo");
+            ck1("//z:/foo", "z:/", "foo", "z:/foo");
+            ck1("z:/foo/bar", "z:/foo", "bar", "z:/foo/bar");
+            ck1("z:foo", "z:", "foo", "z:foo");
+
+            /* Two-arg constructors cases, string parent */
+            ck2("z:", "/", null, "", "z:/");    /* ## ? */
+            ck2("z:", "/foo", "z:/", "foo", "z:/foo");
+            ck2("z:/", "foo", "z:/", "foo", "z:/foo");
+            ck2("z://", "foo", "z:/", "foo", "z:/foo");
+            ck2("z:/", "/foo", "z:/", "foo", "z:/foo");
+            ck2("z:/", "//foo", "z:/", "foo", "z:/foo");
+            ck2("z:/", "foo/", "z:/", "foo", "z:/foo");
+            ck2("//foo", "bar", "//foo", "bar", "//foo/bar");
+
+            /* Two-arg constructor cases, File parent */
+            ck2f("//foo", "bar", "//foo", "bar", "//foo/bar");
+
+        }
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        old = new File("foo/").getPath().equals("foo/");
+        if (old) System.err.println("** Testing old java.io.File class");
+        testBoth();
+        if (win32) testWin32();
+        else testUnix();
+    }
+
+}
diff --git a/test/java/io/File/Create.java b/test/java/io/File/Create.java
new file mode 100644
index 0000000..56f38c2
--- /dev/null
+++ b/test/java/io/File/Create.java
@@ -0,0 +1,58 @@
+/*
+ * 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 4812991 4804456
+ * @summary Test creation of new files with long names
+ */
+
+import java.io.*;
+
+public class Create {
+
+    static final int length = 512;
+
+    public static void main(String[] args) throws Exception {
+        String fileName = createFileName(length);
+        File file = new File(fileName);
+        try {
+            boolean result = file.createNewFile();
+            if (result) {
+                if (!file.exists())
+                    throw new RuntimeException("Result is incorrect");
+            } else {
+                if (file.exists())
+                    throw new RuntimeException("Result is incorrect");
+            }
+        } catch (IOException ioe) {
+            // Correct result on some platforms
+        }
+    }
+
+    public static String createFileName(int length){
+        char[] array = new char[length];
+        for(int i = 0 ; i < length ; i++)
+            array[i] = (char)('0' + (i % 10));
+        return new String(array);
+    }
+}
diff --git a/test/java/io/File/CreateNewFile.java b/test/java/io/File/CreateNewFile.java
new file mode 100644
index 0000000..3f37deb
--- /dev/null
+++ b/test/java/io/File/CreateNewFile.java
@@ -0,0 +1,55 @@
+/*
+ * 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 4130498 4391178
+   @summary Basic test for createNewFile method
+ */
+
+import java.io.*;
+
+
+public class CreateNewFile {
+
+    public static void main(String[] args) throws Exception {
+
+        File f = new File(System.getProperty("test.dir", "."),
+                          "x.CreateNewFile");
+        if (f.exists() && !f.delete())
+            throw new Exception("Cannot delete test file " + f);
+        if (!f.createNewFile())
+            throw new Exception("Cannot create new file " + f);
+        if (!f.exists())
+            throw new Exception("Did not create new file " + f);
+        if (f.createNewFile())
+            throw new Exception("Created existing file " + f);
+
+        try {
+            f = new File("/");
+            if (f.createNewFile())
+                throw new Exception("Created root directory!");
+        } catch (IOException e) {
+            // Exception expected
+        }
+    }
+}
diff --git a/test/java/io/File/DeleteOnExit.java b/test/java/io/File/DeleteOnExit.java
new file mode 100644
index 0000000..205ddbf
--- /dev/null
+++ b/test/java/io/File/DeleteOnExit.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2002-2006 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  4614121 4809375 6437591
+   @summary Basic test for deleteOnExit method
+   @author kladko
+ */
+
+
+import java.io.File;
+
+public class DeleteOnExit  {
+
+    static String tmpdir = System.getProperty("java.io.tmpdir");
+    static String java = System.getProperty("java.home") + File.separator +
+                         "bin" + File.separator + "java";
+    static File file1 = new File(tmpdir + "deletedOnExit1");
+    static File file2 = new File(tmpdir + "deletedOnExit2");
+    static File file3 = new File(tmpdir + "deletedOnExit3");
+
+    // used to verify deletion order
+    static File dir = new File(tmpdir + "deletedOnExitDir");
+    static File file4 = new File(dir + File.separator + "deletedOnExit4");
+    static File file5 = new File(dir + File.separator + "dxnsdnguidfgejngognrogn");
+    static File file6 = new File(dir + File.separator + "mmmmmmsdmfgmdsmfgmdsfgm");
+    static File file7 = new File(dir + File.separator + "12345566777");
+
+    public static void main (String args[]) throws Exception{
+        if (args.length == 0) {
+            Runtime.getRuntime().exec(java +  " DeleteOnExit -test").waitFor();
+            if (file1.exists() || file2.exists() || file3.exists() ||
+                dir.exists()   || file4.exists() || file5.exists() ||
+                file6.exists() || file7.exists())  {
+
+                System.out.println(file1 + ", exists = " + file1.exists());
+                System.out.println(file2 + ", exists = " + file2.exists());
+                System.out.println(file3 + ", exists = " + file3.exists());
+                System.out.println(dir + ", exists = " + dir.exists());
+                System.out.println(file4 + ", exists = " + file4.exists());
+                System.out.println(file5 + ", exists = " + file5.exists());
+                System.out.println(file6 + ", exists = " + file6.exists());
+                System.out.println(file7 + ", exists = " + file7.exists());
+
+                // cleanup undeleted dir if test fails
+                dir.delete();
+
+                throw new Exception("File exists");
+            }
+        } else {
+            file1.createNewFile();
+            file2.createNewFile();
+            file3.createNewFile();
+            file1.deleteOnExit();
+            file2.deleteOnExit();
+            file3.deleteOnExit();
+
+            // verify that deleting a File marked deleteOnExit will not cause a problem
+            // during shutdown.
+            file3.delete();
+
+            // verify that calling deleteOnExit multiple times on a File does not cause
+            // a problem during shutdown.
+            file2.deleteOnExit();
+            file2.deleteOnExit();
+            file2.deleteOnExit();
+
+            // Verify DeleteOnExit Internal implementation deletion order.
+            if (dir.mkdir()) {
+                dir.deleteOnExit();
+
+                file4.createNewFile();
+                file5.createNewFile();
+                file6.createNewFile();
+                file7.createNewFile();
+
+                file4.deleteOnExit();
+                file5.deleteOnExit();
+                file6.deleteOnExit();
+                file7.deleteOnExit();
+            }
+        }
+    }
+}
diff --git a/test/java/io/File/DeleteOnExitLong.java b/test/java/io/File/DeleteOnExitLong.java
new file mode 100644
index 0000000..096d5f0
--- /dev/null
+++ b/test/java/io/File/DeleteOnExitLong.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 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  6197510
+   @summary Test for deleteOnExit method on long filename
+ */
+
+import java.io.File;
+
+public class DeleteOnExitLong  {
+    public static void main (String args[]) throws Exception{
+        File file = new File("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_DeletedOnExitLong").getCanonicalFile();
+        file.createNewFile();
+        file.deleteOnExit();
+    }
+}
diff --git a/test/java/io/File/DeleteOnExitNPE.java b/test/java/io/File/DeleteOnExitNPE.java
new file mode 100644
index 0000000..c45c78e
--- /dev/null
+++ b/test/java/io/File/DeleteOnExitNPE.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2007 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  6526376
+   @summary DeleteOnExitHook.add() produces NullPointerException
+ */
+
+import java.io.*;
+
+/* NullPointerException in exec'ed process if fails.
+ * This testcase is timing sensitive. It may sometimes pass even with this bug
+ * present, but will never fail without it.
+ */
+
+public class DeleteOnExitNPE implements Runnable
+{
+    public static void main(String[] args) throws Exception {
+        if (args.length == 0) {
+            runTest();
+        } else {
+            doTest();
+        }
+    }
+
+    public static void runTest() throws Exception {
+        String cmd = System.getProperty("java.home") + File.separator +
+                     "bin" + File.separator + "java";
+        Process process = Runtime.getRuntime().exec(cmd +  " DeleteOnExitNPE -test");
+        BufferedReader isReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+        BufferedReader esReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+
+        process.waitFor();
+
+        boolean failed = false;
+        String str;
+        while ((str = isReader.readLine()) != null) {
+            failed = true;
+            System.out.println(str);
+        }
+        while ((str = esReader.readLine()) != null) {
+            failed = true;
+            System.err.println(str);
+        }
+
+        if (failed)
+            throw new RuntimeException("Failed: No output should have been received from the process");
+    }
+
+    public static void doTest() {
+        try {
+            File file = File.createTempFile("DeleteOnExitNPE", null);
+            file.deleteOnExit();
+
+            Thread thread = new Thread(new DeleteOnExitNPE());
+            thread.start();
+
+            try {
+                Thread.sleep(2000);
+            } catch (InterruptedException ie) {
+                ie.printStackTrace();
+            }
+
+            System.exit(0);
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+        }
+    }
+
+    public void run() {
+        File file = new File("xxyyzz");
+
+        try {
+            for (;;) {
+                file.deleteOnExit();
+            }
+        } catch (IllegalStateException ise) {
+            // ignore. This is ok.
+            // Trying to add a file to the list of files marked as deleteOnExit when
+            // shutdown is in progress and the DeleteOnExitHook is running.
+        }
+    }
+}
diff --git a/test/java/io/File/EmptyPath.java b/test/java/io/File/EmptyPath.java
new file mode 100644
index 0000000..49e2c53
--- /dev/null
+++ b/test/java/io/File/EmptyPath.java
@@ -0,0 +1,49 @@
+/*
+ * 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 4842706
+   @summary Test some file operations with empty path
+ */
+
+import java.io.*;
+
+public class EmptyPath {
+    public static void main(String [] args) throws Exception {
+        File f = new File("");
+        f.mkdir();
+        try {
+            f.createNewFile();
+            throw new RuntimeException("Expected exception not thrown");
+        } catch (IOException ioe) {
+            // Correct result
+        }
+        try {
+            FileInputStream fis = new FileInputStream(f);
+            fis.close();
+            throw new RuntimeException("Expected exception not thrown");
+        } catch (FileNotFoundException fnfe) {
+            // Correct result
+        }
+    }
+}
diff --git a/test/java/io/File/FileMethods.java b/test/java/io/File/FileMethods.java
new file mode 100644
index 0000000..bf50846
--- /dev/null
+++ b/test/java/io/File/FileMethods.java
@@ -0,0 +1,86 @@
+/*
+ * 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 4107063 4131237
+   @summary Basic test for new File-returning methods
+ */
+
+import java.io.*;
+
+
+public class FileMethods {
+
+    private static void ck(String op, File got, File ans) throws Exception {
+        if (!got.equals(ans))
+            throw new Exception(op + " incorrect");
+    }
+
+    private static void ck(String op, File f, String[] ls, File[] lf)
+        throws Exception
+    {
+        System.err.println("--- " + op);
+        int n = lf.length;
+        if (ls.length != n)
+            throw new Exception("listFiles returned incorrect count");
+        for (int i = 0; i < n; i++) {
+            if (ls[i].equals(lf[i].getName())
+                && lf[i].getParentFile().equals(f)) {
+                System.err.println(ls[i] + " ==> " + lf[i]);
+            } else {
+                throw new Exception("list mismatch: " + ls[i] + ", " + lf[i]);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        File f;
+        f = new File("foo/bar");
+        ck("getParentFile", f.getParentFile(), new File(f.getParent()));
+
+        f = new File(".");
+        ck("getAbsoluteFile",
+           f.getAbsoluteFile(), new File(f.getAbsolutePath()));
+
+        ck("getCanonicalFile",
+           f.getCanonicalFile(), new File(f.getCanonicalPath()));
+
+        f = f.getCanonicalFile();
+        ck("listFiles", f, f.list(), f.listFiles());
+
+        FilenameFilter ff = new FilenameFilter() {
+            public boolean accept(File dir, String name) {
+                return name.endsWith(".class");
+            }};
+        ck("listFiles/filtered", f, f.list(ff), f.listFiles(ff));
+
+        FileFilter ff2 = new FileFilter() {
+            public boolean accept(File f) {
+                return f.getPath().endsWith(".class");
+            }};
+        ck("listFiles/filtered2", f, f.list(ff), f.listFiles(ff2));
+
+    }
+
+}
diff --git a/test/java/io/File/GetAbsolutePath.java b/test/java/io/File/GetAbsolutePath.java
new file mode 100644
index 0000000..ce0d47b
--- /dev/null
+++ b/test/java/io/File/GetAbsolutePath.java
@@ -0,0 +1,95 @@
+/*
+ * 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 4131169 4109131
+   @summary Basic test for getAbsolutePath method
+ */
+
+import java.io.*;
+
+
+public class GetAbsolutePath {
+
+    private static boolean ignoreCase = false;
+
+    private static void ck(String path, String ans) throws Exception {
+        File f = new File(path);
+        String p = f.getAbsolutePath();
+        if ((ignoreCase && p.equalsIgnoreCase(ans)) || p.equals(ans))
+            System.err.println(path + " ==> " + p);
+        else
+            throw new Exception(path + ": expected " + ans + ", got " + p);
+    }
+
+    private static void testWin32() throws Exception {
+        String wd = System.getProperty("user.dir");
+        char d;
+        if ((wd.length() > 2) && (wd.charAt(1) == ':')
+            && (wd.charAt(2) == '\\'))
+            d = wd.charAt(0);
+        else
+            throw new Exception("Current directory has no drive");
+        ck("/foo/bar", d + ":\\foo\\bar");
+        ck("\\foo\\bar", d + ":\\foo\\bar");
+        ck("c:\\foo\\bar", "c:\\foo\\bar");
+        ck("c:/foo/bar", "c:\\foo\\bar");
+        ck("\\\\foo\\bar", "\\\\foo\\bar");
+
+        /* Tricky directory-relative case */
+        d = Character.toLowerCase(d);
+        char z = 0;
+        if (d != 'c') z = 'c';
+        else if (d != 'd') z = 'd';
+        if (z != 0) {
+            File f = new File(z + ":.");
+            if (f.exists()) {
+                String zwd = f.getCanonicalPath();
+                ck(z + ":foo", zwd + "\\foo");
+            }
+        }
+
+        /* Empty path */
+        ck("", wd);
+    }
+
+    private static void testUnix() throws Exception {
+        String wd = System.getProperty("user.dir");
+        ck("foo", wd + "/foo");
+        ck("foo/bar", wd + "/foo/bar");
+        ck("/foo", "/foo");
+        ck("/foo/bar", "/foo/bar");
+
+        /* Empty path */
+        ck("", wd);
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (File.separatorChar == '\\') {
+            ignoreCase = true;
+            testWin32();
+        }
+        if (File.separatorChar == '/') testUnix();
+    }
+
+}
diff --git a/test/java/io/File/GetCanonicalPath.java b/test/java/io/File/GetCanonicalPath.java
new file mode 100644
index 0000000..26cf4a7
--- /dev/null
+++ b/test/java/io/File/GetCanonicalPath.java
@@ -0,0 +1,42 @@
+/*
+ * 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 4899022
+   @summary Look for erroneous representation of drive letter
+ */
+
+import java.io.*;
+
+public class GetCanonicalPath {
+    public static void main(String[] args) throws Exception {
+        if (File.separatorChar == '\\') {
+            testDriveLetter();
+        }
+    }
+    private static void testDriveLetter() throws Exception {
+        String path = new File("c:/").getCanonicalPath();
+        if (path.length() > 3)
+            throw new RuntimeException("Drive letter incorrectly represented");
+    }
+}
diff --git a/test/java/io/File/GetParent.java b/test/java/io/File/GetParent.java
new file mode 100644
index 0000000..cd3180d
--- /dev/null
+++ b/test/java/io/File/GetParent.java
@@ -0,0 +1,79 @@
+/*
+ * 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 4027914
+   @summary Check getParent's handling of root directories
+ */
+
+import java.io.File;
+
+
+public class GetParent {
+
+    static void check(String path, String[] parents) throws Exception {
+        File f = new File(path);
+        String p;
+        System.err.print(path + ":");
+        for (int i = 0; i < parents.length; i++) {
+            p = f.getParent();
+            System.err.print(" (" + p + ")");
+            if (p == null)
+                throw new Exception("No parent for " + f);
+            if (! p.equals(parents[i]))
+                throw new Exception("Wrong parent for " + f
+                                    + ": Expected " + parents[i]
+                                    + ", got " + p);
+            f = new File(p);
+        }
+        if (f.getParent() != null)
+            throw new Exception("Too many parents for " + path);
+        System.err.println();
+    }
+
+    static void testUnix() throws Exception {
+        check("foo", new String[] { });
+        check("./foo", new String[] { "." });
+        check("foo/bar/baz", new String[] { "foo/bar", "foo" });
+        check("../../foo", new String[] { "../..", ".." });
+        check("foo//bar", new String[] { "foo" });
+        check("/foo/bar/baz.gorp",
+              new String[] { "/foo/bar", "/foo", "/" });
+    }
+
+    static void testWin32() throws Exception {
+        System.err.println("Win32");
+        check("foo", new String[] { });
+        check(".\\foo", new String[] { "." });
+        check("foo\\bar\\baz", new String[] { "foo\\bar", "foo" });
+        check("..\\..\\foo", new String[] { "..\\..", ".." });
+        check("c:\\foo\\bar\\baz.xxx",
+              new String[] { "c:\\foo\\bar", "c:\\foo", "c:\\" });
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (File.separatorChar == '/') testUnix();
+        if (File.separatorChar == '\\') testWin32();
+    }
+
+}
diff --git a/test/java/io/File/GetXSpace.java b/test/java/io/File/GetXSpace.java
new file mode 100644
index 0000000..a2855e7
--- /dev/null
+++ b/test/java/io/File/GetXSpace.java
@@ -0,0 +1,387 @@
+/*
+ * Copyright 2005-2006 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 4057701 6286712 6364377
+ * @run build GetXSpace
+ * @run shell GetXSpace.sh
+ * @summary Basic functionality of File.get-X-Space methods.
+ */
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FilePermission;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static java.lang.System.out;
+
+public class GetXSpace {
+
+    private static SecurityManager [] sma = { null, new Allow(), new DenyFSA(),
+                                              new DenyRead() };
+
+    private static final String name = System.getProperty("os.name");
+    private static final String dfFormat;
+    static {
+        if (name.equals("SunOS") || name.equals("Linux")) {
+            // FileSystem Total Used Available Use% MountedOn
+            dfFormat = "([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s]+)";
+        } else if (name.startsWith("Windows")) {
+            // Drive (MountedOn) Available/Total
+            dfFormat = "([^\\s]+)\\s+\\(([^\\s]+)\\)\\s+(\\d+)\\/(\\d+)\\s+";
+        } else {
+            throw new RuntimeException("unrecognized system:"
+                                       + " os.name == " + name);
+        }
+    }
+    private static Pattern dfPattern = Pattern.compile(dfFormat);
+
+    private static int fail = 0;
+    private static int pass = 0;
+    private static Throwable first;
+
+    static void pass() {
+        pass++;
+    }
+
+    static void fail(String p) {
+        if (first == null)
+            setFirst(p);
+        System.err.format("FAILED: %s%n", p);
+        fail++;
+    }
+
+    static void fail(String p, long exp, String cmp, long got) {
+        String s = String.format("'%s': %d %s %d", p, exp, cmp, got);
+        if (first == null)
+            setFirst(s);
+        System.err.format("FAILED: %s%n", s);
+        fail++;
+    }
+
+    private static void fail(String p, Class ex) {
+        String s = String.format("'%s': expected %s - FAILED%n", p, ex.getName());
+        if (first == null)
+            setFirst(s);
+        System.err.format("FAILED: %s%n", s);
+        fail++;
+    }
+
+    private static void setFirst(String s) {
+        try {
+            throw new RuntimeException(s);
+        } catch (RuntimeException x) {
+            first = x;
+        }
+    }
+
+    private static class Space {
+        private static final long KSIZE = 1024;
+        private String name;
+        private long total;
+        private long free;
+
+        Space(String total, String free, String name) {
+            try {
+                this.total = Long.valueOf(total) * KSIZE;
+                this.free = Long.valueOf(free) * KSIZE;
+            } catch (NumberFormatException x) {
+                // the regex should have caught this
+                assert false;
+            }
+            this.name = name;
+        }
+
+        String name() { return name; }
+        long total() { return total; }
+        long free() { return free; }
+        boolean woomFree(long freeSpace) {
+            return ((freeSpace >= (free / 10)) && (freeSpace <= (free * 10)));
+        }
+        public String toString() {
+            return String.format("%s (%d/%d)", name, free, total);
+        }
+    }
+
+    private static ArrayList space(String f) throws IOException {
+        ArrayList al = new ArrayList();
+
+        Process p = null;
+        String cmd = "df -k" + (f == null ? "" : " " + f);
+        p = Runtime.getRuntime().exec(cmd);
+        BufferedReader in = new BufferedReader
+            (new InputStreamReader(p.getInputStream()));
+        String s;
+        int i = 0;
+        StringBuilder sb = new StringBuilder();
+        while ((s = in.readLine()) != null) {
+            // skip header
+            if (i++ == 0 && !name.startsWith("Windows")) continue;
+            sb.append(s).append("\n");
+        }
+
+        Matcher m = dfPattern.matcher(sb);
+        int j = 0;
+        while (j < sb.length()) {
+            if (m.find(j)) {
+                if (!name.startsWith("Windows")) {
+                    // swap can change while this test is running
+                    if (!m.group(1).equals("swap")) {
+                        String name = (f == null ? m.group(4): f);
+                        al.add(new Space(m.group(2), m.group(3), name));;
+                    }
+                } else {
+                    String name = (f == null ? m.group(2) : f);
+                    al.add(new Space(m.group(4), m.group(3), name ));;
+                }
+                j = m.end() + 1;
+            } else {
+                throw new RuntimeException("unrecognized df output format: "
+                                           + "charAt(" + j + ") = '"
+                                           + sb.charAt(j) + "'");
+            }
+        }
+
+        if (al.size() == 0) {
+            // df did not produce output
+            String name = (f == null ? "" : f);
+            al.add(new Space("0", "0", name));
+        }
+        in.close();
+        return al;
+    }
+
+    private static void tryCatch(Space s) {
+        out.format("%s:%n", s.name());
+        File f = new File(s.name());
+        SecurityManager sm = System.getSecurityManager();
+        if (sm instanceof Deny) {
+            String fmt = "  %14s: \"%s\" thrown as expected%n";
+            try {
+                f.getTotalSpace();
+                fail(s.name(), SecurityException.class);
+            } catch (SecurityException x) {
+                out.format(fmt, "getTotalSpace", x);
+                pass();
+            }
+            try {
+                f.getFreeSpace();
+                fail(s.name(), SecurityException.class);
+            } catch (SecurityException x) {
+                out.format(fmt, "getFreeSpace", x);
+                pass();
+            }
+            try {
+                f.getUsableSpace();
+                fail(s.name(), SecurityException.class);
+            } catch (SecurityException x) {
+                out.format(fmt, "getUsableSpace", x);
+                pass();
+            }
+        }
+    }
+
+    private static void compare(Space s) {
+        File f = new File(s.name());
+        long ts = f.getTotalSpace();
+        long fs = f.getFreeSpace();
+        long us = f.getUsableSpace();
+
+        out.format("%s:%n", s.name());
+        String fmt = "  %-4s total= %12d free = %12d usable = %12d%n";
+        out.format(fmt, "df", s.total(), 0, s.free());
+        out.format(fmt, "getX", ts, fs, us);
+
+        // if the file system can dynamically change size, this check will fail
+        if (ts != s.total())
+            fail(s.name(), s.total(), "!=", ts);
+        else
+            pass();
+
+        // unix df returns statvfs.f_bavail
+        long tsp = (!name.startsWith("Windows") ? us : fs);
+        if (!s.woomFree(tsp))
+            fail(s.name(), s.free(), "??", tsp);
+        else
+            pass();
+
+        if (fs > s.total())
+            fail(s.name(), s.total(), ">", fs);
+        else
+            pass();
+
+        if (us > s.total())
+            fail(s.name(), s.total(), ">", us);
+        else
+            pass();
+    }
+
+    private static String FILE_PREFIX = "/getSpace.";
+    private static void compareZeroNonExist() {
+        File f;
+        while (true) {
+            f = new File(FILE_PREFIX + Math.random());
+            if (f.exists())
+                continue;
+            break;
+        }
+
+        long [] s = { f.getTotalSpace(), f.getFreeSpace(), f.getUsableSpace() };
+
+        for (int i = 0; i < s.length; i++) {
+            if (s[i] != 0L)
+                fail(f.getName(), s[i], "!=", 0L);
+            else
+                pass();
+        }
+    }
+
+    private static void compareZeroExist() {
+        try {
+            File f = File.createTempFile("tmp", null, new File("."));
+
+            long [] s = { f.getTotalSpace(), f.getFreeSpace(), f.getUsableSpace() };
+
+            for (int i = 0; i < s.length; i++) {
+                if (s[i] == 0L)
+                    fail(f.getName(), s[i], "==", 0L);
+                else
+                    pass();
+            }
+        } catch (IOException x) {
+            fail("Couldn't create temp file for test");
+        }
+    }
+
+    private static class Allow extends SecurityManager {
+        public void checkRead(String file) {}
+        public void checkPermission(Permission p) {}
+        public void checkPermission(Permission p, Object context) {}
+    }
+
+    private static class Deny extends SecurityManager {
+        public void checkPermission(Permission p) {
+            if (p.implies(new RuntimePermission("setSecurityManager"))
+                || p.implies(new RuntimePermission("getProtectionDomain")))
+              return;
+            super.checkPermission(p);
+        }
+
+        public void checkPermission(Permission p, Object context) {
+            if (p.implies(new RuntimePermission("setSecurityManager"))
+                || p.implies(new RuntimePermission("getProtectionDomain")))
+              return;
+            super.checkPermission(p, context);
+        }
+    }
+
+    private static class DenyFSA extends Deny {
+        private String err = "sorry - getFileSystemAttributes";
+
+        public void checkPermission(Permission p) {
+            if (p.implies(new RuntimePermission("getFileSystemAttributes")))
+                throw new SecurityException(err);
+            super.checkPermission(p);
+        }
+
+        public void checkPermission(Permission p, Object context) {
+            if (p.implies(new RuntimePermission("getFileSystemAttributes")))
+                throw new SecurityException(err);
+            super.checkPermission(p, context);
+        }
+    }
+
+    private static class DenyRead extends Deny {
+        private String err = "sorry - checkRead()";
+
+        public void checkRead(String file) {
+            throw new SecurityException(err);
+        }
+    }
+
+    private static void testFile(String dirName) {
+        out.format("--- Testing %s%n", dirName);
+        ArrayList l;
+        try {
+            l = space(dirName);
+        } catch (IOException x) {
+            throw new RuntimeException(dirName + " can't get file system information", x);
+        }
+        compare((GetXSpace.Space) l.get(0));
+    }
+
+    private static void testDF() {
+        out.format("--- Testing df");
+        // Find all of the partitions on the machine and verify that the size
+        // returned by "df" is equivalent to File.getXSpace() values.
+        ArrayList l;
+        try {
+            l = space(null);
+        } catch (IOException x) {
+            throw new RuntimeException("can't get file system information", x);
+        }
+        if (l.size() == 0)
+            throw new RuntimeException("no partitions?");
+
+        for (int i = 0; i < sma.length; i++) {
+            System.setSecurityManager(sma[i]);
+            SecurityManager sm = System.getSecurityManager();
+            if (sma[i] != null && sm == null)
+                throw new RuntimeException("Test configuration error "
+                                           + " - can't set security manager");
+
+            out.format("%nSecurityManager = %s%n" ,
+                       (sm == null ? "null" : sm.getClass().getName()));
+            for (int j = 0; j < l.size(); j++) {
+                Space s = (GetXSpace.Space) l.get(j);
+                if (sm instanceof Deny) {
+                    tryCatch(s);
+                } else {
+                    compare(s);
+                    compareZeroNonExist();
+                    compareZeroExist();
+                }
+            }
+        }
+    }
+
+    public static void main(String [] args) {
+        if (args.length > 0) {
+            testFile(args[0]);
+        } else {
+            testDF();
+        }
+
+        if (fail != 0)
+            throw new RuntimeException((fail + pass) + " tests: "
+                                       + fail + " failure(s), first", first);
+        else
+            out.format("all %d tests passed%n", fail + pass);
+    }
+}
diff --git a/test/java/io/File/GetXSpace.sh b/test/java/io/File/GetXSpace.sh
new file mode 100644
index 0000000..7ca2436
--- /dev/null
+++ b/test/java/io/File/GetXSpace.sh
@@ -0,0 +1,81 @@
+#
+# Copyright 2006 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.
+#
+
+#
+
+# set platform-dependent variable
+OS=`uname -s`
+case "$OS" in
+  SunOS | Linux ) TMP=/tmp  ;;
+  Windows_98 )    return    ;;
+  Windows* )      SID=`sid`; TMP="c:/temp"  ;;
+  * )
+    echo "Unrecognized system!"
+    exit 1
+    ;;
+esac
+
+TMP1=${TMP}/tmp1_$$
+FAIL=0;
+
+deny() {
+  case "$OS" in
+  Windows* ) chacl -d ${SID}:f $* ;;
+  * )        chmod 000 $*         ;;
+  esac
+}
+
+allow() {
+  case "$OS" in
+  Windows* ) chacl -g ${SID}:f $* ;;
+  * )        chmod 777 $*         ;;
+  esac 
+}
+
+runTest() {
+  ${TESTJAVA}/bin/java -cp ${TESTCLASSES} GetXSpace $* 
+  if [ $? -eq 0 ]
+  then echo "Passed"
+  else
+    echo "FAILED"
+    FAIL=`expr ${FAIL} + 1`
+  fi
+}
+
+# df output
+runTest
+ 
+# readable file in an unreadable directory
+mkdir ${TMP1}
+touch ${TMP1}/foo
+deny ${TMP1}
+runTest ${TMP1}/foo
+allow ${TMP1}
+rm -rf ${TMP1}
+
+if [ ${FAIL} -ne 0 ]
+then 
+  echo ""
+  echo "${FAIL} test(s) failed"
+  exit 1
+fi
diff --git a/test/java/io/File/HashCodeEquals.java b/test/java/io/File/HashCodeEquals.java
new file mode 100644
index 0000000..b4009eb
--- /dev/null
+++ b/test/java/io/File/HashCodeEquals.java
@@ -0,0 +1,59 @@
+/*
+ * 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 4141318
+   @summary Check that equal File instances have identical hash codes
+ */
+
+import java.io.File;
+
+
+public class HashCodeEquals {
+
+    static void test(String fn1, String fn2) throws Exception {
+        File f1 = new File(fn1);
+        File f2 = new File(fn2);
+        if (!f1.equals(f2))
+            throw new Exception("Instances with equal paths are not equal");
+        int h1 = f1.hashCode();
+        int h2 = f2.hashCode();
+        if (h1 != h2)
+            throw new Exception("Hashcodes of equal instances are not equal");
+    }
+
+    static void testWin32() throws Exception {
+        test("a:/foo/bar/baz", "a:/foo/bar/baz");
+        test("A:/Foo/Bar/BAZ", "a:/foo/bar/baz");
+    }
+
+    static void testUnix() throws Exception {
+        test("foo/bar/baz", "foo/bar/baz");
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (File.separatorChar == '\\') testWin32();
+        if (File.separatorChar == '/') testUnix();
+    }
+
+}
diff --git a/test/java/io/File/IsAbsolute.java b/test/java/io/File/IsAbsolute.java
new file mode 100644
index 0000000..b5f7334
--- /dev/null
+++ b/test/java/io/File/IsAbsolute.java
@@ -0,0 +1,63 @@
+/*
+ * 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 4022397
+   @summary General test for isAbsolute
+ */
+
+import java.io.*;
+
+
+public class IsAbsolute {
+
+    private static void ck(String path, boolean ans) throws Exception {
+        File f = new File(path);
+        boolean x = f.isAbsolute();
+        if (x != ans)
+            throw new Exception(path + ": expected " + ans + ", got " + x);
+        System.err.println(path + " ==> " + x);
+    }
+
+    private static void testWin32() throws Exception {
+        ck("/foo/bar", false);
+        ck("\\foo\\bar", false);
+        ck("c:\\foo\\bar", true);
+        ck("c:/foo/bar", true);
+        ck("c:foo\\bar", false);
+        ck("\\\\foo\\bar", true);
+    }
+
+    private static void testUnix() throws Exception {
+        ck("foo", false);
+        ck("foo/bar", false);
+        ck("/foo", true);
+        ck("/foo/bar", true);
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (File.separatorChar == '\\') testWin32();
+        if (File.separatorChar == '/') testUnix();
+    }
+
+}
diff --git a/test/java/io/File/IsHidden.java b/test/java/io/File/IsHidden.java
new file mode 100644
index 0000000..8323a76
--- /dev/null
+++ b/test/java/io/File/IsHidden.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 1998-2007 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 4131223 6470354
+   @summary Basic test for isHidden method
+ */
+
+import java.io.*;
+
+
+public class IsHidden {
+
+    private static String dir = System.getProperty("test.dir", ".");
+
+    private static void ck(String path, boolean ans) throws Exception {
+        File f = new File(path);
+        boolean x = f.isHidden();
+        if (x != ans)
+            throw new Exception(path + ": expected " + ans + ", got " + x);
+        System.err.println(path + " ==> " + x);
+    }
+
+    private static void testWin32() throws Exception {
+        File f = new File(dir, "test");
+        f.deleteOnExit();
+        f.createNewFile();
+        String name = f.getCanonicalPath();
+        Process p = Runtime.getRuntime().exec("cmd.exe /c attrib +H " + name);
+        p.waitFor();
+        ck(name, true);
+
+        ck(".foo", false);
+        ck("foo", false);
+    }
+
+    private static void testUnix() throws Exception {
+        ck(dir + "/IsHidden.java", false);
+        ck(dir + "/.", true);
+        ck(".", true);
+        ck("..", true);
+        ck(".foo", true);
+        ck("foo", false);
+        ck("", false);
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (File.separatorChar == '\\') testWin32();
+        if (File.separatorChar == '/') testUnix();
+    }
+
+}
diff --git a/test/java/io/File/ListNull.java b/test/java/io/File/ListNull.java
new file mode 100644
index 0000000..5cce2b6
--- /dev/null
+++ b/test/java/io/File/ListNull.java
@@ -0,0 +1,53 @@
+/*
+ * 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 4140693
+   @summary Make sure that java.io.File.list*(null) returns an array, not null
+ */
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+
+
+public class ListNull {
+
+    static void go(String what, Object[] fs) throws Exception {
+        if (fs == null)
+            throw new Exception(what + " returned null");
+        System.err.println("-- " + what);
+        for (int i = 0; i < fs.length; i++)
+            System.err.println(fs[i]);
+    }
+
+    public static void main(String[] args) throws Exception {
+        File d = new File(".");
+        go("list()", d.list());
+        go("listFiles()", d.listFiles());
+        go("list(null)", d.list(null));
+        go("listFiles((FilenameFilter)null)", d.listFiles((FilenameFilter)null));
+        go("listFiles((FileFilter)null)", d.listFiles((FileFilter)null));
+    }
+
+}
diff --git a/test/java/io/File/ListRoots.java b/test/java/io/File/ListRoots.java
new file mode 100644
index 0000000..a77fb25
--- /dev/null
+++ b/test/java/io/File/ListRoots.java
@@ -0,0 +1,51 @@
+/*
+ * 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 4071322
+   @summary Basic test for listRoots method
+ */
+
+import java.io.*;
+
+
+public class ListRoots {
+
+    public static void main(String[] args) throws Exception {
+        File[] rs = File.listRoots();
+        for (int i = 0; i < rs.length; i++) {
+            System.out.println(i + ": " + rs[i]);
+        }
+
+        File f = new File(System.getProperty("test.src", "."),
+                          "ListRoots.java");
+        String cp = f.getCanonicalPath();
+        for (int i = 0; i < rs.length; i++) {
+            if (cp.startsWith(rs[i].getPath())) break;
+            if (i == rs.length - 1)
+                throw new Exception(cp + " does not have a recognized root");
+        }
+
+    }
+
+}
diff --git a/test/java/io/File/ListSpace.java b/test/java/io/File/ListSpace.java
new file mode 100644
index 0000000..31eafbb
--- /dev/null
+++ b/test/java/io/File/ListSpace.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004 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 4923243
+ * @summary check list with spaces at end of path
+ */
+
+import java.io.*;
+
+public class ListSpace {
+    public static void main(String[] args) throws Exception {
+        File d = new File(".");
+        d = new File(d.getCanonicalPath()+" ");
+        if (!d.isDirectory())
+            return;
+        if (d.list() == null)
+            throw new RuntimeException("list is null");
+    }
+}
diff --git a/test/java/io/File/MaxPathLength.java b/test/java/io/File/MaxPathLength.java
new file mode 100644
index 0000000..effcc19
--- /dev/null
+++ b/test/java/io/File/MaxPathLength.java
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2002-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 4759207 4403166 4165006 4403166 6182812 6274272
+   @summary Test to see if win32 path length can be greater than 260
+ */
+
+import java.io.*;
+
+public class MaxPathLength {
+    private static String sep = File.separator;
+    private static String pathComponent = sep +
+        "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+    private static String fileName =
+                 "areallylongfilenamethatsforsur";
+    private static boolean isWindows = false;
+    private static long totalSpace;
+    private static long freeSpace;
+    private static long usableSpace;
+    private static long ONEMEGA = 1024*1024;
+
+    public static void main(String[] args) throws Exception {
+        String osName = System.getProperty("os.name");
+        if (osName.startsWith("Windows")) {
+            isWindows = true;
+            if (osName.startsWith("Windows 9") ||
+                osName.startsWith("Windows Me"))
+            return; // win9x/Me cannot handle long paths
+        }
+
+        if (osName.startsWith("SunOS")) {
+            return; // We don't run this test on Solaris either.
+                    // Some Solaris machines have very "slow" disk
+                    // access performance which causes this one
+                    // to timeout.
+        }
+
+        if (isWindows) {
+            File f = new File(".");
+            totalSpace = f.getTotalSpace()/ONEMEGA;
+            freeSpace = f.getFreeSpace()/ONEMEGA;
+            usableSpace = f.getUsableSpace()/ONEMEGA;
+        }
+
+        for (int i = 4; i < 7; i++) {
+            String name = fileName;
+            while (name.length() < 256) {
+                testLongPath (i, name, false);
+                testLongPath (i, name, true);
+                name += "A";
+            }
+        }
+
+        // Testing below will not be run if "-extra" is not
+        if (args.length == 0 ||
+            !"-extra".equals(args[0]) ||
+            !isWindows)
+            return;
+
+        /* Testings below should not be run on a remote
+           dir that exists on a Solaris machine */
+        for (int i = 20; i < 21; i++) {
+            String name = fileName;
+            while (name.length() < 256) {
+                testLongPath (i, name, false);
+                testLongPath (i, name, true);
+                name += "A";
+            }
+        }
+    }
+
+    private static int lastMax = 0;
+    static void testLongPath(int max, String fn,
+                             boolean tryAbsolute) throws Exception {
+        String[] created = new String[max];
+        String pathString = ".";
+        for (int i = 0; i < max -1; i++) {
+            pathString = pathString + pathComponent;
+            created[max - 1 -i] = pathString;
+
+        }
+        File dirFile = new File(pathString);
+        File f = new File(pathString + sep + fn);
+
+        String tPath = f.getPath();
+        if (tryAbsolute) {
+            tPath = f.getCanonicalPath();
+        }
+        created[0] = tPath;
+
+        //for getCanonicalPath testing on win32
+        File fu = new File(pathString + sep + fn.toUpperCase());
+
+        if (dirFile.exists()) {
+            System.err.println("Warning: Test directory structure exists already!");
+            return;
+        }
+        boolean couldMakeTestDirectory = dirFile.mkdirs();
+        if (!couldMakeTestDirectory) {
+            throw new RuntimeException ("Could not create test directory structure");
+        }
+        try {
+            if (tryAbsolute)
+                dirFile = new File(dirFile.getCanonicalPath());
+            if (!dirFile.isDirectory())
+                throw new RuntimeException ("File.isDirectory() failed");
+            if (isWindows && lastMax != max) {
+                long diff = totalSpace - dirFile.getTotalSpace()/ONEMEGA;
+                if (diff < -5 || diff > 5)
+                    throw new RuntimeException ("File.getTotalSpace() failed");
+                diff = freeSpace - dirFile.getFreeSpace()/ONEMEGA;
+                if (diff < -5 || diff > 5)
+                    throw new RuntimeException ("File.getFreeSpace() failed");
+                diff = usableSpace - dirFile.getUsableSpace()/ONEMEGA;
+                if (diff < -5 || diff > 5)
+                    throw new RuntimeException ("File.getUsableSpace() failed");
+                lastMax = max;
+            }
+            f = new File(tPath);
+            if (!f.createNewFile()) {
+                throw new RuntimeException ("File.createNewFile() failed");
+            }
+            if (!f.exists())
+                throw new RuntimeException ("File.exists() failed");
+            if (!f.isFile())
+                throw new RuntimeException ("File.isFile() failed");
+            if (!f.canRead())
+                throw new RuntimeException ("File.canRead() failed");
+            if (!f.canWrite())
+                throw new RuntimeException ("File.canWrite() failed");
+            if (!f.delete())
+                throw new RuntimeException ("File.delete() failed");
+            FileOutputStream fos = new FileOutputStream(f);
+            fos.write(1);
+            fos.close();
+            if (f.length() != 1)
+                throw new RuntimeException ("File.length() failed");
+            long time = System.currentTimeMillis();
+            if (!f.setLastModified(time))
+                throw new RuntimeException ("File.setLastModified() failed");
+            if (f.lastModified() == 0) {
+                throw new RuntimeException ("File.lastModified() failed");
+            }
+            String[] list = dirFile.list();
+            if (list == null || !fn.equals(list[0])) {
+                throw new RuntimeException ("File.list() failed");
+            }
+
+            File[] flist = dirFile.listFiles();
+            if (flist == null || !fn.equals(flist[0].getName()))
+                throw new RuntimeException ("File.listFiles() failed");
+
+            if (isWindows &&
+                !fu.getCanonicalPath().equals(f.getCanonicalPath()))
+                throw new RuntimeException ("getCanonicalPath() failed");
+
+            char[] cc = tPath.toCharArray();
+            cc[cc.length-1] = 'B';
+            File nf = new File(new String(cc));
+            if (!f.renameTo(nf)) {
+                /*there is a known issue that renameTo fails if
+                  (1)the path is a UNC path and
+                  (2)the path length is bigger than 1092
+                  so don't stop if above are true
+                */
+                String abPath = f.getAbsolutePath();
+                if (!abPath.startsWith("\\\\") ||
+                    abPath.length() < 1093) {
+                    throw new RuntimeException ("File.renameTo() failed for lenth="
+                                                + abPath.length());
+                }
+                return;
+            }
+            if (!nf.canRead())
+                throw new RuntimeException ("Renamed file is not readable");
+            if (!nf.canWrite())
+                throw new RuntimeException ("Renamed file is not writable");
+            if (nf.length() != 1)
+                throw new RuntimeException ("Renamed file's size is not correct");
+            nf.renameTo(f);
+            /* add a script to test these two if we got a regression later
+            if (!f.setReadOnly())
+                throw new RuntimeException ("File.setReadOnly() failed");
+            f.deleteOnExit();
+            */
+        } finally {
+            // Clean up
+            for (int i = 0; i < max; i++) {
+                pathString = created[i];
+                // Only works with completex canonical paths
+                File df = new File(pathString);
+                pathString = df.getCanonicalPath();
+                df = new File(pathString);
+                if (!df.delete())
+                    System.out.printf("Delete failed->%s\n", pathString);
+            }
+        }
+    }
+}
diff --git a/test/java/io/File/Mkdir.java b/test/java/io/File/Mkdir.java
new file mode 100644
index 0000000..e47c77b
--- /dev/null
+++ b/test/java/io/File/Mkdir.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 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 4344760
+   @summary Test mkdirs with . in path
+ */
+import java.io.*;
+
+public class Mkdir {
+    static File a = new File("a");
+    static File a_dot = new File(a, ".");
+    static File a_dot_b = new File(a_dot, "b");
+
+    public static void main(String[] args) throws Exception {
+        if (!a_dot_b.mkdirs())
+            throw new Exception("Test failed");
+    }
+}
diff --git a/test/java/io/File/NullArgs.java b/test/java/io/File/NullArgs.java
new file mode 100644
index 0000000..b4e677f
--- /dev/null
+++ b/test/java/io/File/NullArgs.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 1999-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 4203650
+   @summary Ensure that File constructors and methods catch null arguments
+   @run main/othervm NullArgs
+ */
+
+
+import java.io.File;
+
+public class NullArgs {
+
+    public static void main(String[] args) throws Exception {
+
+        for (int i = 0;; i++) {
+            try {
+                switch (i) {
+                case 0:  new File((String)null);  break;
+                case 1:  new File((String)null, null);  break;
+                case 2:  new File((File)null, null);  break;
+                case 3:  File.createTempFile(null, null, null);  break;
+                case 4:  File.createTempFile(null, null);  break;
+                case 5:  new File("foo").compareTo(null);  break;
+                case 6:  new File("foo").renameTo(null);  break;
+                default:
+                    System.err.println();
+                    return;
+                }
+            } catch (NullPointerException x) {
+                System.err.print(i + " ");
+                continue;
+            }
+            throw new Exception("NullPointerException not thrown (case " +
+                                i + ")");
+        }
+
+    }
+
+}
diff --git a/test/java/io/File/SetAccess.java b/test/java/io/File/SetAccess.java
new file mode 100644
index 0000000..0be12bb
--- /dev/null
+++ b/test/java/io/File/SetAccess.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright 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 4167472 5097703 6216563 6284003
+   @summary Basic test for setWritable/Readable/Executable methods
+ */
+
+import java.io.*;
+
+public class SetAccess {
+    public static void main(String[] args) throws Exception {
+        File d = new File(System.getProperty("test.dir", "."));
+
+        File f = new File(d, "x.SetAccessPermission");
+        if (f.exists() && !f.delete())
+            throw new Exception("Can't delete test file: " + f);
+        OutputStream o = new FileOutputStream(f);
+        o.write('x');
+        o.close();
+        doTest(f);
+
+        f = new File(d, "x.SetAccessPermission.dir");
+        if (f.exists() && !f.delete())
+            throw new Exception("Can't delete test dir: " + f);
+        if (!f.mkdir())
+            throw new Exception(f + ": Cannot create directory");
+        doTest(f);
+    }
+
+    public static void doTest(File f) throws Exception {
+        f.setReadOnly();
+        if (!System.getProperty("os.name").startsWith("Windows")) {
+            if (!f.setWritable(true, true) ||
+                !f.canWrite() ||
+                permission(f).charAt(2) != 'w')
+                throw new Exception(f + ": setWritable(true, ture) Failed");
+            if (!f.setWritable(false, true) ||
+                f.canWrite() ||
+                permission(f).charAt(2) != '-')
+                throw new Exception(f + ": setWritable(false, true) Failed");
+            if (!f.setWritable(true, false) ||
+                !f.canWrite() ||
+                !permission(f).matches(".(.w.){3}"))
+                throw new Exception(f + ": setWritable(true, false) Failed");
+            if (!f.setWritable(false, false) ||
+                f.canWrite() ||
+                !permission(f).matches(".(.-.){3}"))
+                throw new Exception(f + ": setWritable(false, true) Failed");
+            if (!f.setWritable(true) || !f.canWrite() ||
+                permission(f).charAt(2) != 'w')
+                throw new Exception(f + ": setWritable(true, ture) Failed");
+            if (!f.setWritable(false) || f.canWrite() ||
+                permission(f).charAt(2) != '-')
+                throw new Exception(f + ": setWritable(false, true) Failed");
+            if (!f.setExecutable(true, true) ||
+                !f.canExecute() ||
+                permission(f).charAt(3) != 'x')
+                throw new Exception(f + ": setExecutable(true, true) Failed");
+            if (!f.setExecutable(false, true) ||
+                f.canExecute() ||
+                permission(f).charAt(3) != '-')
+                throw new Exception(f + ": setExecutable(false, true) Failed");
+            if (!f.setExecutable(true, false) ||
+                !f.canExecute() ||
+                !permission(f).matches(".(..x){3}"))
+                throw new Exception(f + ": setExecutable(true, false) Failed");
+            if (!f.setExecutable(false, false) ||
+                f.canExecute() ||
+                !permission(f).matches(".(..-){3}"))
+                throw new Exception(f + ": setExecutable(false, false) Failed");
+            if (!f.setExecutable(true) || !f.canExecute() ||
+                permission(f).charAt(3) != 'x')
+                throw new Exception(f + ": setExecutable(true, true) Failed");
+            if (!f.setExecutable(false) || f.canExecute() ||
+                permission(f).charAt(3) != '-')
+                throw new Exception(f + ": setExecutable(false, true) Failed");
+            if (!f.setReadable(true, true) ||
+                !f.canRead() ||
+                permission(f).charAt(1) != 'r')
+                throw new Exception(f + ": setReadable(true, true) Failed");
+            if (!f.setReadable(false, true) ||
+                f.canRead() ||
+                permission(f).charAt(1) != '-')
+                throw new Exception(f + ": setReadable(false, true) Failed");
+            if (!f.setReadable(true, false) ||
+                !f.canRead() ||
+                !permission(f).matches(".(r..){3}"))
+                throw new Exception(f + ": setReadable(true, false) Failed");
+            if (!f.setReadable(false, false) ||
+                f.canRead() ||
+                !permission(f).matches(".(-..){3}"))
+                throw new Exception(f + ": setReadable(false, false) Failed");
+            if (!f.setReadable(true) || !f.canRead() ||
+                permission(f).charAt(1) != 'r')
+                throw new Exception(f + ": setReadable(true, true) Failed");
+            if (!f.setReadable(false) || f.canRead() ||
+                permission(f).charAt(1) != '-')
+                throw new Exception(f + ": setReadable(false, true) Failed");
+        } else {
+            //Windows platform
+            if (!f.setWritable(true, true) || !f.canWrite())
+                throw new Exception(f + ": setWritable(true, ture) Failed");
+            if (!f.setWritable(true, false) || !f.canWrite())
+                throw new Exception(f + ": setWritable(true, false) Failed");
+            if (!f.setWritable(true) || !f.canWrite())
+                throw new Exception(f + ": setWritable(true, ture) Failed");
+            if (!f.setExecutable(true, true) || !f.canExecute())
+                throw new Exception(f + ": setExecutable(true, true) Failed");
+            if (!f.setExecutable(true, false) || !f.canExecute())
+                throw new Exception(f + ": setExecutable(true, false) Failed");
+            if (!f.setExecutable(true) || !f.canExecute())
+                throw new Exception(f + ": setExecutable(true, true) Failed");
+            if (!f.setReadable(true, true) || !f.canRead())
+                throw new Exception(f + ": setReadable(true, true) Failed");
+            if (!f.setReadable(true, false) || !f.canRead())
+                throw new Exception(f + ": setReadable(true, false) Failed");
+            if (!f.setReadable(true) || !f.canRead())
+                throw new Exception(f + ": setReadable(true, true) Failed");
+            if (f.isDirectory()) {
+                //All directories on Windows always have read&write access perm,
+                //setting a directory to "unwritable" actually means "not deletable"
+                if (!f.setWritable(false, true) || !f.canWrite())
+                    throw new Exception(f + ": setWritable(false, true) Failed");
+                if (!f.setWritable(false, false) || !f.canWrite())
+                    throw new Exception(f + ": setWritable(false, true) Failed");
+                if (!f.setWritable(false) || !f.canWrite())
+                    throw new Exception(f + ": setWritable(false, true) Failed");
+            } else {
+                if (!f.setWritable(false, true) || f.canWrite())
+                    throw new Exception(f + ": setWritable(false, true) Failed");
+                if (!f.setWritable(false, false) || f.canWrite())
+                    throw new Exception(f + ": setWritable(false, true) Failed");
+                if (!f.setWritable(false) || f.canWrite())
+                    throw new Exception(f + ": setWritable(false, true) Failed");
+            }
+            if (f.setExecutable(false, true))
+                throw new Exception(f + ": setExecutable(false, true) Failed");
+            if (f.setExecutable(false, false))
+                throw new Exception(f + ": setExecutable(false, false) Failed");
+            if (f.setExecutable(false))
+                throw new Exception(f + ": setExecutable(false, true) Failed");
+            if (f.setReadable(false, true))
+                throw new Exception(f + ": setReadable(false, true) Failed");
+            if (f.setReadable(false, false))
+                throw new Exception(f + ": setReadable(false, false) Failed");
+            if (f.setReadable(false))
+                throw new Exception(f + ": setReadable(false, true) Failed");
+        }
+        if (f.exists() && !f.delete())
+            throw new Exception("Can't delete test dir: " + f);
+    }
+
+    private static String permission(File f) throws Exception {
+        byte[] bb = new byte[1024];
+        String command = f.isDirectory()?"ls -dl ":"ls -l ";
+        int len = Runtime.getRuntime()
+                         .exec(command + f.getPath())
+                         .getInputStream()
+                         .read(bb, 0, 1024);
+        if (len > 0)
+            return new String(bb, 0, len).substring(0, 10);
+        return "";
+    }
+}
diff --git a/test/java/io/File/SetLastModified.java b/test/java/io/File/SetLastModified.java
new file mode 100644
index 0000000..22cb532
--- /dev/null
+++ b/test/java/io/File/SetLastModified.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 1998-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 4091757
+   @summary Basic test for setLastModified method
+ */
+
+import java.io.*;
+
+
+public class SetLastModified {
+
+    private static void ck(File f, long nt, long rt) throws Exception {
+        if (rt == nt) return;
+        if ((rt / 10 == nt / 10)
+            || (rt / 100 == nt / 100)
+            || (rt / 1000 == nt / 1000)
+            || (rt / 10000 == (nt / 10000))) {
+            System.err.println(f + ": Time set to " + nt
+                               + ", rounded down by filesystem to " + rt);
+            return;
+        }
+        if ((rt / 10 == (nt + 5) / 10)
+            || (rt / 100 == (nt + 50) / 100)
+            || (rt / 1000 == (nt + 500) / 1000)
+            || (rt / 10000 == ((nt + 5000) / 10000))) {
+            System.err.println(f + ": Time set to " + nt
+                               + ", rounded up by filesystem to " + rt);
+            return;
+        }
+        throw new Exception(f + ": Time set to " + nt
+                            + ", then read as " + rt);
+    }
+
+    public static void main(String[] args) throws Exception {
+        File d = new File(System.getProperty("test.dir", "."));
+        File d2 = new File(d, "x.SetLastModified.dir");
+        File f = new File(d2, "x.SetLastModified");
+        long ot, t;
+
+        /* New time: One week ago */
+        long nt = System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 7;
+
+        if (f.exists()) f.delete();
+        if (d2.exists()) d2.delete();
+        if (!d2.mkdir()) {
+            throw new Exception("Can't create test directory " + d2);
+        }
+
+        boolean threw = false;
+        try {
+            d2.setLastModified(-nt);
+        } catch (IllegalArgumentException x) {
+            threw = true;
+        }
+        if (!threw)
+            throw new Exception("setLastModified succeeded with a negative time");
+
+        ot = d2.lastModified();
+        if (ot != 0) {
+            if (d2.setLastModified(nt)) {
+                ck(d2, nt, d2.lastModified());
+                d2.setLastModified(ot);
+            } else {
+                System.err.println("Warning: setLastModified on directories "
+                                   + "not supported");
+            }
+        }
+
+        if (f.exists()) {
+            if (!f.delete())
+                throw new Exception("Can't delete test file " + f);
+        }
+        if (f.setLastModified(nt))
+            throw new Exception("Succeeded on non-existent file: " + f);
+
+        OutputStream o = new FileOutputStream(f);
+        o.write('x');
+        o.close();
+        ot = f.lastModified();
+        if (!f.setLastModified(nt))
+            throw new Exception("setLastModified failed on file: " + f);
+        ck(f, nt, f.lastModified());
+
+        if (!f.delete()) throw new Exception("Can't delete test file " + f);
+        if (!d2.delete()) throw new Exception("Can't delete test directory " + d2);
+    }
+
+}
diff --git a/test/java/io/File/SetReadOnly.java b/test/java/io/File/SetReadOnly.java
new file mode 100644
index 0000000..ed89513
--- /dev/null
+++ b/test/java/io/File/SetReadOnly.java
@@ -0,0 +1,69 @@
+/*
+ * 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 4091757
+   @summary Basic test for setReadOnly method
+ */
+
+import java.io.*;
+
+
+public class SetReadOnly {
+
+    public static void main(String[] args) throws Exception {
+        File d = new File(System.getProperty("test.dir", "."));
+        File f = new File(d, "x.SetReadOnly");
+
+        if (f.exists()) {
+            if (!f.delete())
+                throw new Exception("Can't delete test file " + f);
+        }
+        if (f.setReadOnly())
+            throw new Exception("Succeeded on non-existent file: " + f);
+
+        OutputStream o = new FileOutputStream(f);
+        o.write('x');
+        o.close();
+        if (!f.setReadOnly())
+            throw new Exception(f + ": Failed on file");
+        if (f.canWrite())
+            throw new Exception(f + ": File is writeable");
+
+        f = new File(d, "x.SetReadOnly.dir");
+        if (f.exists()) {
+            if (!f.delete())
+                throw new Exception("Can't delete test directory " + f);
+        }
+        if (!f.mkdir())
+            throw new Exception(f + ": Cannot create directory");
+        if (!f.setReadOnly())
+            throw new Exception(f + ": Failed on directory");
+        if (f.canWrite())
+            throw new Exception(f + ": Directory is writeable");
+        if (!f.delete())
+            throw new Exception(f + ": Cannot delete directory");
+
+    }
+
+}
diff --git a/test/java/io/File/ToURI.java b/test/java/io/File/ToURI.java
new file mode 100644
index 0000000..716bdeb
--- /dev/null
+++ b/test/java/io/File/ToURI.java
@@ -0,0 +1,76 @@
+/*
+ * 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 4468322
+   @summary Unit test for File.toURI()/File(URI)
+ */
+
+import java.io.*;
+import java.net.URI;
+
+
+public class ToURI {
+
+    static PrintStream log = System.err;
+    static int failures = 0;
+
+    static void go(String fn) throws Exception {
+        File f = new File(fn);
+        log.println();
+        log.println(f);
+        URI u = f.toURI();
+        log.println("  --> " + u);
+        File g = new File(u);
+        log.println("  --> " + g);
+        if (!f.getAbsoluteFile().equals(g)) {
+            log.println("ERROR: Expected " + f + ", got " + g);
+            failures++;
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        go("foo");
+        go("foo/bar/baz");
+        go("/cdrom/#2");
+        go("My Computer");
+        go("/tmp");
+        go("/");
+        go("");
+        go("!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
+           + "abcdefghijklmnopqrstuvwxyz{|}~\u00D0");
+
+        if (File.separatorChar == '\\') {
+            go("c:");
+            go("c:\\");
+            go("c:\\a\\b");
+            go("\\\\foo");
+            go("\\\\foo\\bar");
+        }
+
+        if (failures > 0)
+            throw new Exception("Tests failed: " + failures);
+
+    }
+
+}
diff --git a/test/java/io/File/ToURL.java b/test/java/io/File/ToURL.java
new file mode 100644
index 0000000..ba4b410
--- /dev/null
+++ b/test/java/io/File/ToURL.java
@@ -0,0 +1,54 @@
+/*
+ * 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 4166902
+   @summary Ensure that File.toURL does not append a slash to root directories
+ */
+
+import java.io.File;
+import java.net.URL;
+
+
+public class ToURL {
+
+    static void go(String fn) throws Exception {
+        File f = new File(fn);
+        URL u = f.toURL();
+        String ufn = u.getFile();
+        if (!ufn.endsWith("/"))
+            throw new Exception(u + " does not end with slash");
+        if (ufn.endsWith("//"))
+            throw new Exception(u + " ends with two slashes");
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (File.separatorChar == '/') {
+            go("/");
+        } else if (File.separatorChar == '\\') {
+            go("\\");
+            go("c:\\");
+        }
+    }
+
+}
diff --git a/test/java/io/File/Unicode.java b/test/java/io/File/Unicode.java
new file mode 100644
index 0000000..46289f2
--- /dev/null
+++ b/test/java/io/File/Unicode.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2004 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 5016938
+ * @summary Test file operations with Unicode filenames
+ * @author Martin Buchholz
+ */
+
+import java.io.*;
+
+public class Unicode
+{
+    static int fail = 0;
+    static void fail(String msg) {
+        fail++;
+        System.err.println(msg);
+    }
+
+    static boolean creat(File f) throws Exception {
+        try {
+            FileOutputStream out = new FileOutputStream(f);
+            out.write(new byte[]{'a', 'b', 'c'});
+            out.close();
+            // Check that the file we tried to create has the expected name
+            return find(f);
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    static boolean find(File f) throws Exception {
+        String fn = f.getPath();
+        String[] fns = new File(".").list();
+        for (int i = 0; i < fns.length; i++)
+            if (fns[i].equals(fn))
+                return true;
+        return false;
+    }
+
+    static void sanityCheck(File f) throws Exception {
+        if (! f.exists())      fail("! f.exists()");
+        if (  f.length() != 3) fail("  f.length() != 3");
+        if (  f.isAbsolute())  fail("  f.isAbsolute()");
+        if (! f.canRead())     fail("! f.canRead()");
+        if (! f.canWrite())    fail("! f.canWrite()");
+        if (  f.isHidden())    fail("  f.isHidden()");
+        if (! f.isFile())      fail("! f.isFile()");
+        if (  f.isDirectory()) fail("  f.isDirectory()");
+    }
+
+    public static void main(String [] args) throws Exception {
+        final File f1 = new File("\u0411.tst");
+        final File f2 = new File("\u0412.tst");
+
+        try {
+            if (! creat(f1))
+                // Couldn't create file with Unicode filename?
+                return;
+
+            System.out.println("This system supports Unicode filenames!");
+            sanityCheck(f1);
+
+            f1.renameTo(f2);
+            sanityCheck(f2);
+            if (! f2.delete()) fail("! f2.delete()");
+            if (  f2.exists()) fail("  f2.exists()");
+            if (  f1.exists()) fail("  f1.exists()");
+            if (  f1.delete()) fail("  f1.delete()");
+
+            if (fail != 0) throw new Exception(fail + " failures");
+        } finally {
+            f1.delete();
+            f2.delete();
+        }
+    }
+}
diff --git a/test/java/io/File/WinDeviceName.java b/test/java/io/File/WinDeviceName.java
new file mode 100644
index 0000000..45f34c4
--- /dev/null
+++ b/test/java/io/File/WinDeviceName.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2006 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 6176051
+   @summary Check isFile's handling of Windows device names
+ */
+
+import java.io.File;
+
+public class WinDeviceName {
+    private static String devnames[] = {
+        "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4",
+        "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2",
+        "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9",
+        "CLOCK$"
+    };
+    public static void main(String[] args) throws Exception {
+        String osName = System.getProperty("os.name");
+        if (!osName.startsWith("Windows")) {
+            return;
+        }
+        for (int i = 0; i < devnames.length; i++) {
+            if (new File(devnames[i]).isFile() ||
+                new File(devnames[i] + ".txt").isFile()) {
+                if ("CLOCK$".equals(devnames[i]) &&
+                    (osName.startsWith("Windows 9") ||
+                     osName.startsWith("Windows Me"))) {
+                    //"CLOCK$" is a reserved device name for NT
+                    continue;
+                }
+                throw new Exception("isFile() returns true for Device name "
+                                    +  devnames[i]);
+            }
+        }
+    }
+}
diff --git a/test/java/io/File/WinMaxPath.java b/test/java/io/File/WinMaxPath.java
new file mode 100644
index 0000000..671fd7f
--- /dev/null
+++ b/test/java/io/File/WinMaxPath.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 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 6384833
+   @summary Check if appropriate exception FileNotFoundException gets
+            thrown when the pathlengh exceeds the limit.
+ */
+
+import java.io.*;
+public class WinMaxPath {
+    public static void main(String[] args) throws Exception {
+        String osName = System.getProperty("os.name");
+        if (!osName.startsWith("Windows")) {
+            return;
+        }
+        try {
+            char[] as = new char[65000];
+            java.util.Arrays.fill(as, 'a');
+            FileOutputStream out = new FileOutputStream(new String(as));
+            out.close();
+        } catch (FileNotFoundException x) {
+            //expected
+        }
+    }
+}
diff --git a/test/java/io/File/WinSpecialFiles.java b/test/java/io/File/WinSpecialFiles.java
new file mode 100644
index 0000000..647f458
--- /dev/null
+++ b/test/java/io/File/WinSpecialFiles.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 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 6192331 6348207
+   @summary Check if File.exists()/length() works correctly on Windows
+            special files hiberfil.sys and pagefile.sys
+ */
+
+import java.io.File;
+public class WinSpecialFiles {
+    public static void main(String[] args) throws Exception {
+        String osName = System.getProperty("os.name");
+        if (!osName.startsWith("Windows")) {
+            return;
+        }
+        File root = new File("C:\\");
+        File[] dir = root.listFiles();
+        for (int i = 0; i < dir.length; i++) {
+            if (!dir[i].exists()) {
+                throw new Exception("exists() returns false for <"
+                                    + dir[i].getPath() + ">");
+            }
+            String name = dir[i].getPath().toLowerCase();
+            if (name.indexOf("pagefile.sys") != -1 ||
+                name.indexOf("hiberfil.sys") != -1) {
+                if (dir[i].length() == 0) {
+                    throw new Exception("Size of existing <"
+                                        + dir[i].getPath()
+                                        + " is ZERO");
+                }
+            }
+        }
+    }
+}
diff --git a/test/java/io/File/basic.sh b/test/java/io/File/basic.sh
new file mode 100644
index 0000000..fa11c66
--- /dev/null
+++ b/test/java/io/File/basic.sh
@@ -0,0 +1,47 @@
+#! /bin/sh
+
+#
+# Copyright 1998-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
+  TESTCLASSES=.
+fi
+
+rm -rf x.Basic.*
+rm -f x.Basic.non
+echo xyzzy > x.Basic.rw
+touch x.Basic.ro; chmod ugo-w x.Basic.ro
+mkdir x.Basic.dir
+if $TESTJAVA/bin/java $* -classpath $TESTCLASSES Basic; then
+  [ -f x.Basic.rw ] && (echo "x.Basic.rw not deleted"; exit 1)
+  ([ -d x.Basic.dir ] || [ \! -d x.Basic.dir2 ]) \
+    && (echo "x.Basic.dir not renamed"; exit 1)
+  [ \! -d x.Basic.nonDir ] && (echo "x.Basic.nonDir not created"; exit 1)
+  [ -f x.Basic.non ] && (echo "x.Basic.non not deleted"; exit 1)
+  exit 0
+else
+  exit 1
+fi
diff --git a/test/java/io/File/createTempFile/Patterns.java b/test/java/io/File/createTempFile/Patterns.java
new file mode 100644
index 0000000..02059e0
--- /dev/null
+++ b/test/java/io/File/createTempFile/Patterns.java
@@ -0,0 +1,71 @@
+/*
+ * 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 4152178
+   @summary Check various temp-file prefix/suffix cases */
+
+import java.io.File;
+import java.io.IOException;
+
+public class Patterns {
+
+    static File dir = new File(".");
+
+    static void ckn(String prefix, String suffix) throws Exception {
+        try {
+            File f = File.createTempFile(prefix, suffix, dir);
+            f.deleteOnExit();
+        } catch (Exception x) {
+            if ((x instanceof IOException)
+                || (x instanceof NullPointerException)
+                || (x instanceof IllegalArgumentException)) {
+                System.err.println("\"" + prefix + "\", \"" + suffix
+                                   + "\" failed as expected: " + x.getMessage());
+                return;
+            }
+            throw x;
+        }
+        throw new Exception("\"" + prefix + "\", \"" + suffix
+                            + "\" should have failed");
+    }
+
+    static void cky(String prefix, String suffix) throws Exception {
+        File f = File.createTempFile(prefix, suffix, dir);
+        f.deleteOnExit();
+        System.err.println("\"" + prefix + "\", \"" + suffix
+                           + "\" --> " + f.getPath());
+    }
+
+    public static void main(String[] args) throws Exception {
+        ckn(null, null);
+        ckn("", null);
+        ckn("x", null);
+        ckn("xx", null);
+        cky("xxx", null);
+        cky("xxx", "");
+        cky("xxx", "y");
+        cky("xxx", ".y");
+    }
+
+}
diff --git a/test/java/io/File/isDirectory/Applet.html b/test/java/io/File/isDirectory/Applet.html
new file mode 100644
index 0000000..69d57f4
--- /dev/null
+++ b/test/java/io/File/isDirectory/Applet.html
@@ -0,0 +1,2 @@
+<!---->
+<applet code=Applet.class width=100 height=100></applet>
diff --git a/test/java/io/File/isDirectory/Applet.java b/test/java/io/File/isDirectory/Applet.java
new file mode 100644
index 0000000..65ccf36
--- /dev/null
+++ b/test/java/io/File/isDirectory/Applet.java
@@ -0,0 +1,48 @@
+/*
+ * 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 4054511
+   @summary Check that applets don't get a security exception when invoking
+            the File.isDirectory method on a non-existent directory
+   @author Mark Reinhold
+   @run applet Applet.html
+ */
+
+import java.io.*;
+
+
+public class Applet extends java.applet.Applet {
+
+    void go(String fn) {
+        File f = new File(fn);
+        System.err.println(fn + ": " + f.isDirectory());
+    }
+
+    public void init() {
+        String nxdir = "non_EX_is_TENT_dir_EC_tory";
+        go(nxdir);
+        go(nxdir + File.separator + "bar" + File.separator + "baz");
+    }
+
+}