Attributes.readBasicFileAttributes() throws AssertionError

Rajendra Gutupalli Rajendra.Gutupalli at Sun.COM
Tue Jan 6 02:15:08 PST 2009


Hi Alan,

I started looking the areas that are newly introduced (new to me). Here 
I see one issue with b98 when tired in Windows and Linux.
I just passed null argument for LinkOption to 
Attributres.readBasickFileAttributes() method. It throws
AssertionError saying "Should not get here". As usual I think it should 
throw NPE here.

Please see the code and result.

<code>
public class Test6 {

    public static void main(String... args) throws Exception {
        String lnk = "d:\\testdir\\s....";
        Path path = Paths.get(lnk);
        BasicFileAttributes ba = 
Attributes.readBasicFileAttributes(path, (LinkOption) null);
        System.out.println(ba.isDirectory());
    }
}
<code>
<result>
Exception in thread "main" java.lang.AssertionError: Should not get here
        at sun.nio.fs.WindowsPath.followLinks(WindowsPath.java:950)
        at sun.nio.fs.WindowsPath.getFileAttributeView(WindowsPath.java:962)
        at 
java.nio.file.attribute.Attributes.readBasicFileAttributes(Attributes.java:320)
        at adhoc.Test6.main(Test6.java:19)
</result>


Thanks
Rajendra.




More information about the nio-dev mailing list