From 88f2e10376c55f480fd0dbd222b8c1725571c6df Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Fri, 26 Dec 2003 21:11:03 +0000 Subject: 2003-12-26 Guilhem Lavaux * java/io/FileInputStream.java (FileInputStream(String)): Call FileInputStream(File). (FileInputStream(File)): Check whether the argument is a directory. From-SVN: r75039 --- libjava/java/io/FileInputStream.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'libjava/java') diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java index 4c599d1..c88f83d 100644 --- a/libjava/java/io/FileInputStream.java +++ b/libjava/java/io/FileInputStream.java @@ -79,11 +79,7 @@ public class FileInputStream extends InputStream */ public FileInputStream(String name) throws FileNotFoundException { - SecurityManager s = System.getSecurityManager(); - if (s != null) - s.checkRead(name); - - fd = new FileDescriptor(name, FileDescriptor.READ); + this(new File(name)); } /** @@ -104,7 +100,14 @@ public class FileInputStream extends InputStream */ public FileInputStream(File file) throws FileNotFoundException { - this(file.getPath()); + SecurityManager s = System.getSecurityManager(); + if (s != null) + s.checkRead(file.getPath()); + + if (file.isDirectory()) + throw new FileNotFoundException(file.getPath() + " is a directory"); + + fd = new FileDescriptor(file.getPath(), FileDescriptor.READ); } /** -- cgit v1.1