[kaffe] CVS kaffe (robilad): Improved FileChannelImpl error handling

Kaffe CVS cvs-commits at kaffe.org
Fri Mar 11 15:18:27 PST 2005


PatchSet 5523 
Date: 2005/03/11 23:13:43
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Improved FileChannelImpl error handling

2005-03-11  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java
        (FileChannelImpl(File, int)) Close opened file if directory.
        Removed needless call to file.getPath().

Members: 
	ChangeLog:1.3697->1.3698 
	libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3697 kaffe/ChangeLog:1.3698
--- kaffe/ChangeLog:1.3697	Fri Mar 11 20:42:28 2005
+++ kaffe/ChangeLog	Fri Mar 11 23:13:43 2005
@@ -1,3 +1,9 @@
+2005-03-11  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java
+	(FileChannelImpl(File, int)) Close opened file if directory. 
+	Removed needless call to file.getPath().
+
 2005-03-11 Dalibor Topic <robilad at kaffe.org>
 
 	Resynced with GNU Classpath.
Index: kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java
diff -u kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java:1.5 kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java:1.6
--- kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java:1.5	Thu Mar 10 01:07:27 2005
+++ kaffe/libraries/javalib/gnu/java/nio/channels/FileChannelImpl.java	Fri Mar 11 23:13:46 2005
@@ -111,7 +111,18 @@
     // First open the file and then check if it is a a directory
     // to avoid race condition.
     if (file.isDirectory())
-      throw new FileNotFoundException(file.getPath() + " is a directory");
+      {
+	try 
+	  {
+	      close();
+	  }
+	catch (IOException e)
+	  {
+	      /* ignore it */
+	  }
+
+	throw new FileNotFoundException(path + " is a directory");
+      }
   }
 
   /* Used by init() (native code) */




More information about the kaffe mailing list