OSDN Git Service

2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Dec 2003 21:11:03 +0000 (21:11 +0000)
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Dec 2003 21:11:03 +0000 (21:11 +0000)
* java/io/FileInputStream.java
(FileInputStream(String)): Call FileInputStream(File).
(FileInputStream(File)): Check whether the argument is a directory.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75039 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/io/FileInputStream.java

index d566535..fd7b37b 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2003-12-26  Michael Koch  <konqueror@gmx.de>
 
        * Makefile.am (rmi_java_source_files):
index 4c599d1..c88f83d 100644 (file)
@@ -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);
   }
 
   /**