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
Tue Jun 10 01:58:27 PDT 2008
Alan Bateman wrote:
> Rajendra Gutupalli wrote:
>> 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>
>>
> UOE would be the correct exception but in this case there shouldn't be
> any exception because, strange as it may be, NTFS allows sym links
> (which are a type of reparse point) to have named streams. So this is
> a bug, and as it happens, is exactly the same reason why you can't
> write a directory's named attributes. The broken code arises because
> we open the unnamed stream before the named stream to ensure a
> reasonable error in the event that the unnamed stream doesn't exist
> (or is not accessible). I've fixed it in my repository so will be in
> the next build. Thanks, as always, for bashing on specific areas to
> find problems like this.
Hi Alan,
The reported bugs have been fixed and working fine with your latest JPRT
job. I have few queries regarding the same. Could you please clarify the
following queries?
1) In my Vista Box, I have a FAT32 drive, when I tried to add attributes
for a file in FAT32 file system, NamedAttributeView#write throws
"FileSystemException e:\java:txt The filename,directory name or volume
label syntax is incorrect", My query here is should it throw
UnsupportedOperationException since the named attributes in FAT32 are
not supported?
2) How can we add named attributes to a symbolic link files in Vista one
command line? when I tried adding using cat > linkfile:test it did not
work for me.
Thanks
Rajendra.
>
> -Alan.
More information about the nio-dev
mailing list