Should it be UnsupportedOppException or IOException for writing named attr to a link file without following it(Windows Vista)??
Alan Bateman
Alan.Bateman at Sun.COM
Tue Jun 10 02:44:54 PDT 2008
Rajendra Gutupalli wrote:
> Hi Alan,
>
> The reported bugs have been fixed and working fine with your latest
> JPRT job.
Thanks for verifying. I've also improved the unit test for this so that
we properly exercise this part of the API on all platforms. I don't know
if I mentioned to you, but there is one issue in this area that I
haven't had time to resolve yet. The bug is that you can't currently get
the list the named attributes once a file has been made sparse (the list
method will throw an IOException). It's on my "to do" list and this is
really just a Windows XP issue because the Win32 APIs we need are
available in Windows Server 2003 and newer.
> 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?
The I/O exception is correct for the case that the underlying file store
doesn't support named attributes. The rational for this is that isn't
not possible to know in advance if they are supported or not (think sym
links between file systems or other changes to the file system during
the running of the VM). As regards the error message - it's not ideal
but is the same error that you will get if you try to do the same thing
with a native application. For your tests, perhaps you can ask the
underlying FileStore if it supports them, eg:
boolean supported =
file.getFileStore().supportsFileAttributeView(NamedFileAttributeView.class);
> 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.
>
I'm not aware of any tools included in Vista that can do this. Usually
the file attributes of symbolic links aren't interesting (except of
course to know if a file is a link) and I don't expect we'll encounter
applications wanting to do this.
-Alan.
More information about the nio-dev
mailing list