--- 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");