6728842: File.setReadOnly does not make a directory read-only (win)
6464744: java/io/File/SetAccess.java ignores sticky bit
Reviewed-by: forax
diff --git a/test/java/io/File/SetReadOnly.java b/test/java/io/File/SetReadOnly.java
index 2d348ed..1c1301b 100644
--- a/test/java/io/File/SetReadOnly.java
+++ b/test/java/io/File/SetReadOnly.java
@@ -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");