[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: Check whether FileChannelImpl was actually opened befo
From: |
Mark Wielaard |
Subject: |
[cp-patches] FYI: Check whether FileChannelImpl was actually opened before finalizing close. |
Date: |
Sun, 11 Sep 2005 21:28:54 +0200 |
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 <address@hidden>
* 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
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: Check whether FileChannelImpl was actually opened before finalizing close.,
Mark Wielaard <=