Hi,

We would always try to close a FileChannelImpl when it was finalized
even if it was never properly closed. Although this is not fatal it did
can generate lots of spurious close() calls on the invalid -1 file
descriptor, resulting in IOExceptions, if an application tried to open
lots of non-existing files. This patch only calls close if fd has been
correctly set in the constructor.

2005-09-11  Mark Wielaard  <[EMAIL PROTECTED]>

  * gnu/java/nio/channels/FileChannelImpl.java (finalize): Check whether
  fd != -1 before calling close().

Committed,

Mark

--- gnu/java/nio/channels/FileChannelImpl.java  26 Jul 2005 12:01:10 -0000     
1.18
+++ gnu/java/nio/channels/FileChannelImpl.java  11 Sep 2005 19:24:14 -0000
@@ -175,7 +175,8 @@
    */
   protected void finalize() throws IOException
   {
-    this.close();
+    if (fd != -1)
+      close();
   }

   public int read (ByteBuffer dst) throws IOException

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to