Attributes.readDosFileAttributes() does not throw UOE (Lin 64 bit)

Rajendra Gutupalli Rajendra.Gutupalli at Sun.COM
Tue Jul 29 05:49:45 PDT 2008


Hi Alan,

When I ran the following code in Linux 32 bit and 64 bit platforms I see 
huge difference. Could you please tell me whether 
Attributes.readDosFileAttributes() throw UOE in Linux 64 bit platform. I 
observed FileStore.supportsFileAttributeView(DosFileAttributeView.class) 
returns false but Attributes.readDosFileAttributes() does not throw UOE 
in Linux 64 bit platform.
Please see the following code and result. Please tell me why there is 
difference in behavior and also in Linux 32 DosFileAttributs.isHidden() 
returns false for '.testfile' is that okay?

<code>
import java.nio.file.*;
import java.nio.file.attribute.*;

class Test {
  public static void main(String... args) throws Exception {
     Path path = Paths.get(args[0]);
     FileStore fs = path.getFileStore();
     System.out.println("supports DosFileAttributeView ?? 
"+fs.supportsFileAttributeView(DosFileAttributeView.class));
     DosFileAttributes dfa = Attributes.readDosFileAttributes(path,false);
     System.out.println("is hidden " + dfa.isHidden());
  }
}
</code>
Result in different platfoms:

<Linux 64 bit>
bash-3.00$ java -d64 -cp . Test .
supports DosFileAttributeView ?? false
Exception in thread "main" java.nio.file.FileSystemException: .: 
Operation not supported
        at 
sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
        at 
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at 
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at 
sun.nio.fs.LinuxDosFileAttributeView.readAttributes(LinuxDosFileAttributeView.java:137)
        at 
java.nio.file.attribute.Attributes.readDosFileAttributes(Attributes.java:163)
        at Test.main(Test.java:9)

bash-3.00$ uname -a
Linux hostname  2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:56:28 EST 2006 
x86_64 x86_64 x86_64 GNU/Linux
</Linux 64 bit>

<Linux 32 bit>
rajendra at client24$ java -cp . Test .testfile
supports DosFileAttributeView ?? true
is hiddend false

rajendra at client24$ uname -a
Linux client24 2.6.24-19-generic #1 SMP Wed Jun 4 16:35:01 UTC 2008 i686 
GNU/Linux
</Linux 32 bit>

Thanks
Rajendra.




More information about the nio-dev mailing list