diff options
-rw-r--r-- | openjdk/sun/nio/fs/NetFileSystemProvider.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/openjdk/sun/nio/fs/NetFileSystemProvider.java b/openjdk/sun/nio/fs/NetFileSystemProvider.java index 3a16383c..1f112199 100644 --- a/openjdk/sun/nio/fs/NetFileSystemProvider.java +++ b/openjdk/sun/nio/fs/NetFileSystemProvider.java @@ -1141,7 +1141,10 @@ final class NetFileSystemProvider extends AbstractFileSystemProvider if (false) throw new cli.System.IO.FileNotFoundException(); if (false) throw new cli.System.IO.IOException(); FileInfo info = new FileInfo(path); - if (!info.get_Exists()) + // We have to rely on the (undocumented) fact that FileInfo.Attributes returns -1 + // when the path does not exist. We need this to work for both files and directories + // and this is the only efficient way to do that. + if (info.get_Attributes().Value == -1) { throw new NoSuchFileException(path); } |