test/java/io/File/SetAccess.java

Print this page

        

@@ -25,10 +25,11 @@
    @bug 4167472 5097703 6216563 6284003 6728842 6464744
    @summary Basic test for setWritable/Readable/Executable methods
  */
 
 import java.io.*;
+import java.nio.file.*;
 import java.nio.file.attribute.*;
 
 public class SetAccess {
     public static void main(String[] args) throws Exception {
         File d = new File(System.getProperty("test.dir", "."));

@@ -176,10 +177,10 @@
         if (f.exists() && !f.delete())
             throw new Exception("Can't delete test dir: " + f);
     }
 
     private static String permission(File f) throws Exception {
-        PosixFileAttributes attrs = Attributes.readPosixFileAttributes(f.toPath());
+        PosixFileAttributes attrs = Files.readAttributes(f.toPath(), PosixFileAttributes.class);
         String type = attrs.isDirectory() ? "d" : " ";
         return type + PosixFilePermissions.toString(attrs.permissions());
     }
 }