diff options
author | Guilhem Lavaux <guilhem@kaffe.org> | 2003-12-26 21:11:03 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-12-26 21:11:03 +0000 |
commit | 88f2e10376c55f480fd0dbd222b8c1725571c6df (patch) | |
tree | 2587f33dc97c6624cedb6ae8feaf93ea79d1aaf9 /libjava/java | |
parent | 06fc4e41862913b5e556508bdd762cb2918fa15e (diff) | |
download | gcc-88f2e10376c55f480fd0dbd222b8c1725571c6df.tar.gz |
2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
* java/io/FileInputStream.java
(FileInputStream(String)): Call FileInputStream(File).
(FileInputStream(File)): Check whether the argument is a directory.
From-SVN: r75039
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/io/FileInputStream.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java index 4c599d11d1b..c88f83db445 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); } /** |