4939819: File.canWrite() returns false for the "My Documents" directory (win)
Reviewed-by: iris
diff --git a/test/java/io/File/SetReadOnly.java b/test/java/io/File/SetReadOnly.java
index ed89513..6bfedea 100644
--- a/test/java/io/File/SetReadOnly.java
+++ b/test/java/io/File/SetReadOnly.java
@@ -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");