aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io/FileInputStream.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/io/FileInputStream.java')
-rw-r--r--libjava/java/io/FileInputStream.java15
1 files changed, 9 insertions, 6 deletions
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);
}
/**