jdk/test/java/io/File/SetReadOnly.java
changeset 6884 65b1fa0a0fae
parent 5506 202f599c92aa
child 7668 d4a77089c587
--- a/jdk/test/java/io/File/SetReadOnly.java	Mon Oct 11 22:32:55 2010 -0700
+++ b/jdk/test/java/io/File/SetReadOnly.java	Tue Oct 12 08:49:33 2010 +0100
@@ -22,7 +22,7 @@
  */
 
 /* @test
-   @bug 4091757 4939819
+   @bug 4091757 4939819 6728842
    @summary Basic test for setReadOnly method
  */
 
@@ -57,17 +57,8 @@
         }
         if (!f.mkdir())
             throw new Exception(f + ": Cannot create directory");
-        if (!f.setReadOnly())
-            throw new Exception(f + ": Failed on directory");
-        // 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.setReadOnly() && f.canWrite())
+            throw new Exception(f + ": Directory is writeable");
         if (!f.delete())
             throw new Exception(f + ": Cannot delete directory");