jdk/test/java/io/File/SetReadOnly.java
changeset 691 2033c9b86813
parent 2 90ce3da70b43
child 715 f16baef3a20e
--- a/jdk/test/java/io/File/SetReadOnly.java	Thu Jun 05 13:42:47 2008 +0200
+++ b/jdk/test/java/io/File/SetReadOnly.java	Thu Jun 05 14:44:30 2008 +0100
@@ -22,7 +22,7 @@
  */
 
 /* @test
-   @bug 4091757
+   @bug 4091757 4939819
    @summary Basic test for setReadOnly method
  */
 
@@ -59,8 +59,15 @@
             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");
+        // The readonly attribute on Windows does not make a folder read-only
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            if (!f.canWrite())
+                throw new Exception(f + ": Directory is not writeable");
+        } else {
+            if (f.canWrite())
+                throw new Exception(f + ": Directory is writeable");
+        }
+
         if (!f.delete())
             throw new Exception(f + ": Cannot delete directory");