@@ -64,7 +64,7 @@ public FileAttributes( @Nonnull File file, @Nonnull Map<Integer, String> userCac
64
64
Path path = file .toPath ();
65
65
if ( AttributeUtils .isUnix ( path ) )
66
66
{
67
- Map <String , Object > attrs = Files .readAttributes ( path , "unix:* " , LinkOption .NOFOLLOW_LINKS );
67
+ Map <String , Object > attrs = Files .readAttributes ( path , "unix:permissions,gid,uid,isSymbolicLink,mode " , LinkOption .NOFOLLOW_LINKS );
68
68
this .permissions = (Set <PosixFilePermission >) attrs .get ( "permissions" );
69
69
70
70
groupId = (Integer ) attrs .get ( "gid" );
@@ -76,7 +76,8 @@ public FileAttributes( @Nonnull File file, @Nonnull Map<Integer, String> userCac
76
76
}
77
77
else
78
78
{
79
- this .groupName = ( (Principal ) attrs .get ( "group" ) ).getName ();
79
+ Object group = Files .getAttribute ( path , "unix:group" , LinkOption .NOFOLLOW_LINKS );
80
+ this .groupName = ( (Principal ) group ).getName ();
80
81
groupCache .put ( groupId , this .groupName );
81
82
}
82
83
userId = (Integer ) attrs .get ( "uid" );
@@ -87,7 +88,8 @@ public FileAttributes( @Nonnull File file, @Nonnull Map<Integer, String> userCac
87
88
}
88
89
else
89
90
{
90
- this .userName = ( (Principal ) attrs .get ( "owner" ) ).getName ();
91
+ Object owner = Files .getAttribute ( path , "unix:owner" , LinkOption .NOFOLLOW_LINKS );
92
+ this .userName = ( (Principal ) owner ).getName ();
91
93
userCache .put ( userId , this .userName );
92
94
}
93
95
octalMode = (Integer ) attrs .get ( "mode" ) & 0xfff ; // Mask off top bits for compatibilty. Maybe check if we
0 commit comments