diff options
author | jfrijters <jfrijters> | 2014-08-26 14:04:12 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2014-08-26 14:04:12 +0400 |
commit | bbef5425037efaf4fc15ed038788bb22e48380e7 (patch) | |
tree | 1e571c693c62da9d39297ebe7affef1c2ea9ce01 /openjdk/sun | |
parent | 6eabab15b884d813755322f57978d10d0c8948cf (diff) |
Bug fix. Reading/writing attributes of non-existing file should throw NoSuchFileException.
Diffstat (limited to 'openjdk/sun')
-rw-r--r-- | openjdk/sun/nio/fs/NetFileSystemProvider.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/openjdk/sun/nio/fs/NetFileSystemProvider.java b/openjdk/sun/nio/fs/NetFileSystemProvider.java index 11686c3f..3a16383c 100644 --- a/openjdk/sun/nio/fs/NetFileSystemProvider.java +++ b/openjdk/sun/nio/fs/NetFileSystemProvider.java @@ -1140,7 +1140,12 @@ final class NetFileSystemProvider extends AbstractFileSystemProvider if (false) throw new cli.System.ArgumentException(); if (false) throw new cli.System.IO.FileNotFoundException(); if (false) throw new cli.System.IO.IOException(); - return new DosFileAttributesImpl(new FileInfo(path)); + FileInfo info = new FileInfo(path); + if (!info.get_Exists()) + { + throw new NoSuchFileException(path); + } + return new DosFileAttributesImpl(info); } catch (cli.System.IO.FileNotFoundException _) { @@ -1193,6 +1198,10 @@ final class NetFileSystemProvider extends AbstractFileSystemProvider info.set_Attributes(cli.System.IO.FileAttributes.wrap(info.get_Attributes().Value & ~attr)); } } + catch (cli.System.IO.FileNotFoundException _) + { + throw new NoSuchFileException(path); + } catch (cli.System.ArgumentException | cli.System.IO.IOException x) { |