File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
src/java.base/share/classes/java/io Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -640,11 +640,24 @@ private int getBooleanAttributes0(File f) {
640640 // Also, notice that Windows FS does not support Posix attributes, which is expected.
641641 // Checking for Posix attributes first prevents from checking DOS attributes on Linux,
642642 // even though Posix permissions aren't used in this method.
643- BasicFileAttributes attrs ;
644- try {
645- attrs = Files .readAttributes (path , PosixFileAttributes .class );
646- } catch (UnsupportedOperationException _) {
647- attrs = Files .readAttributes (path , DosFileAttributes .class );
643+ BasicFileAttributes attrs = null ;
644+ Set <String > supportedFileAttributeViews = path .getFileSystem ().supportedFileAttributeViews ();
645+ if (supportedFileAttributeViews .contains ("posix" )) {
646+ try {
647+ attrs = Files .readAttributes (path , PosixFileAttributes .class );
648+ } catch (UnsupportedOperationException ignored ) {
649+ // Nothing.
650+ }
651+ }
652+ if (attrs == null && supportedFileAttributeViews .contains ("dos" )) {
653+ try {
654+ attrs = Files .readAttributes (path , DosFileAttributes .class );
655+ } catch (UnsupportedOperationException ignored ) {
656+ // Nothing.
657+ }
658+ }
659+ if (attrs == null ) {
660+ attrs = Files .readAttributes (path , BasicFileAttributes .class );
648661 }
649662
650663 return BA_EXISTS
You can’t perform that action at this time.
0 commit comments