[kaffe] CVS kaffe (guilhem): Fixed FileOutputStream constructors.

Kaffe CVS cvs-commits at kaffe.org
Fri Apr 16 07:49:08 PDT 2004


PatchSet 4649 
Date: 2004/04/16 14:22:22
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixed FileOutputStream constructors.

       * libraries/javalib/java/io/FileOutputStream.java
        (FileOutputStream): Reorganized constructors. Check whether the
        given path is a directory now.

        Reported by Nektarios Papadopoulos <npapadop at inaccessnetworks.com>

Members: 
	ChangeLog:1.2225->1.2226 
	libraries/javalib/java/io/FileOutputStream.java:1.12->1.13 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2225 kaffe/ChangeLog:1.2226
--- kaffe/ChangeLog:1.2225	Fri Apr 16 13:18:55 2004
+++ kaffe/ChangeLog	Fri Apr 16 14:22:22 2004
@@ -1,3 +1,11 @@
+2004-04-16  Guilhem Lavaux <guilhem at kaffe.org>
+
+	* libraries/javalib/java/io/FileOutputStream.java
+	(FileOutputStream): Reorganized constructors. Check whether the
+	given path is a directory now.
+
+	Reported by Nektarios Papadopoulos <npapadop at inaccessnetworks.com>
+
 2004-04-16  Dalibor Topic <robilad at kaffe.org>
 
 	* config/i386/jit.h:
Index: kaffe/libraries/javalib/java/io/FileOutputStream.java
diff -u kaffe/libraries/javalib/java/io/FileOutputStream.java:1.12 kaffe/libraries/javalib/java/io/FileOutputStream.java:1.13
--- kaffe/libraries/javalib/java/io/FileOutputStream.java:1.12	Mon Apr 12 11:40:26 2004
+++ kaffe/libraries/javalib/java/io/FileOutputStream.java	Fri Apr 16 14:22:21 2004
@@ -81,13 +81,7 @@
   public FileOutputStream (String path, boolean append)
     throws SecurityException, FileNotFoundException
   {
-    SecurityManager s = System.getSecurityManager();
-    if (s != null)
-      s.checkWrite(path);
-    ch = new FileChannelImpl (path, (append
-				     ? FileChannelImpl.WRITE
-				     | FileChannelImpl.APPEND
-				     : FileChannelImpl.WRITE));
+    this(new File(path), append);
   }
 
   /**
@@ -130,7 +124,7 @@
   public FileOutputStream (File file)
     throws SecurityException, FileNotFoundException
   {
-    this (file.getPath(), false);
+    this(file, false);
   }
 
   /**
@@ -156,7 +150,17 @@
   public FileOutputStream (File file, boolean append)
     throws FileNotFoundException
   {
-    this (file.getPath(), append);
+    SecurityManager s = System.getSecurityManager();
+    if (s != null)
+      s.checkWrite(path);
+
+    if (file.isDirectory())
+      throw new FileNotFoundException(file.getPath() + " is a directory");
+
+   ch = new FileChannelImpl (file.getPath(), (append
+				     ? FileChannelImpl.WRITE
+				     | FileChannelImpl.APPEND
+				     : FileChannelImpl.WRITE));
   }
 
   /**




More information about the kaffe mailing list