This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: java.io.FileInputStream


Hi list,


I commited the attached patch to merge fixes in classpath.


Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2489
diff -u -b -B -r1.2489 ChangeLog
--- ChangeLog	26 Dec 2003 16:25:57 -0000	1.2489
+++ ChangeLog	26 Dec 2003 21:10:33 -0000
@@ -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: java/io/FileInputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/FileInputStream.java,v
retrieving revision 1.18
diff -u -b -B -r1.18 FileInputStream.java
--- java/io/FileInputStream.java	13 Jul 2003 16:53:05 -0000	1.18
+++ java/io/FileInputStream.java	26 Dec 2003 21:10:38 -0000
@@ -79,11 +79,7 @@
    */
   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 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);
   }
 
   /**

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]