From bbef5425037efaf4fc15ed038788bb22e48380e7 Mon Sep 17 00:00:00 2001 From: jfrijters Date: Tue, 26 Aug 2014 10:04:12 +0000 Subject: Bug fix. Reading/writing attributes of non-existing file should throw NoSuchFileException. --- openjdk/sun/nio/fs/NetFileSystemProvider.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'openjdk/sun') 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) { -- cgit v1.2.3