mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8255576: (fs) Files.isHidden() throws ArrayIndexOutOfBoundsException (unix)
Reviewed-by: alanb
This commit is contained in:
parent
fe7672bac6
commit
f61ce32770
3 changed files with 13 additions and 3 deletions
|
@ -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] == '.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -243,7 +243,7 @@ class UnixPath implements Path {
|
|||
}
|
||||
|
||||
// returns {@code true} if this path is an empty path
|
||||
private boolean isEmpty() {
|
||||
boolean isEmpty() {
|
||||
return path.length == 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue