Should it be UnsupportedOppException or IOException for writing named attr to a link file without following it(Windows Vista)??

Rajendra Gutupalli Rajendra.Gutupalli at Sun.COM
Mon Jun 9 04:34:26 PDT 2008


Hi Alan,

When I tried to write a named attribute  to a link file in Windows Vista 
without following it, NamedAttributeView#write() throws IOException 
where as in Linux and Solaris the write() method
throws UnsupportedOperationException for the same. Could you please tell 
me what should the method write() throw in case of Windows Vista when we 
don't follow a link.
(Spec says for write method "UnsupportedOperationException: If not 
following links, the file is a link, and the implementation does not 
support accessing named attributes of a symbolic link" )
Please see the exceptions I got in Windows Vista and Linux.

<Windows Vista>
Exception in thread "main" java.io.IOException: File is reparse point
        at 
sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:75)
        at 
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
        at 
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
        at 
sun.nio.fs.WindowsNamedAttributeView.write(WindowsNamedAttributeView.java:271)
        at Adhoc.NamedTest.main(NamedTest.java:19)
</Vista>
<Linux>
Exception in thread "main" java.lang.UnsupportedOperationException: Too 
many levels of symbolic links (not following links)
    at sun.nio.fs.UnixPath.openForAttributeAccess(UnixPath.java:598)
    at 
sun.nio.fs.LinuxNamedAttributeView.write(LinuxNamedAttributeView.java:186)
    at NamedTest1.main(NamedTest1.java:13)
</Linux>

Thanks
Rajendra.





More information about the nio-dev mailing list