test/java/io/File/IsHidden.java

Print this page

        

@@ -25,10 +25,11 @@
    @bug 4131223 6470354
    @summary Basic test for isHidden method
  */
 
 import java.io.*;
+import java.nio.file.Files;
 import java.nio.file.attribute.DosFileAttributeView;
 
 public class IsHidden {
 
     private static String dir = System.getProperty("test.dir", ".");

@@ -40,11 +41,11 @@
             throw new Exception(path + ": expected " + ans + ", got " + x);
         System.err.println(path + " ==> " + x);
     }
 
     private static void setHidden(File f, boolean value) throws IOException {
-        f.toPath().getFileAttributeView(DosFileAttributeView.class).setHidden(value);
+        Files.getFileAttributeView(f.toPath(), DosFileAttributeView.class).setHidden(value);
     }
 
     private static void testWin32() throws Exception {
         File f = new File(dir, "test");
         f.deleteOnExit();