8255576: (fs) Files.isHidden() throws ArrayIndexOutOfBoundsException (unix)

Reviewed-by: alanb
This commit is contained in:
Christian Stein 2020-11-01 12:39:43 +00:00 committed by Alan Bateman
parent fe7672bac6
commit f61ce32770
3 changed files with 13 additions and 3 deletions

View file

@ -352,7 +352,14 @@ public abstract class UnixFileSystemProvider
UnixPath name = file.getFileName();
if (name == null)
return false;
return (name.asByteArray()[0] == '.');
byte[] path;
if (name.isEmpty()) { // corner case for empty paths
path = name.getFileSystem().defaultDirectory();
} else {
path = name.asByteArray();
}
return path[0] == '.';
}
/**