[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-classpath] [bug #13499] gnu.java.nio.channels.FileChannelImpl final
From: |
anonymous |
Subject: |
[bug-classpath] [bug #13499] gnu.java.nio.channels.FileChannelImpl finalize problem |
Date: |
Wed, 22 Jun 2005 08:33:13 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; U; en) Opera 8.01 |
URL:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=13499>
Summary: gnu.java.nio.channels.FileChannelImpl finalize
problem
Project: classpath
Submitted by: None
Submitted on: Wed 06/22/2005 at 04:33
Category: classpath
Severity: 3 - Normal
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Platform Version: None
_______________________________________________________
Details:
The original finalize method in class
gnu.java.nio.channels.FileChannelImpl:
protected void finalize() throws IOException
{
this.close();
}
If constructor of FileChannelImpl throws an exception,
as used in java.io.RandomAccessFile:
FileChannelImpl ch = new FileChannelImpl (fileName, fdmode);
this assignment is not completed. Anyway an object is already constructed by
the VM and it have to be collected as no one refers it. Finalize method is
invoked. Fd for the object has the initial value of -1 and closed flag in the
super class AbstractInterruptibleChannel is false,
and here we are in the native implCloseChannel method where to close a file
with a fd = -1. >>> java.io.IOException
This tiny check is proposed to avoid the trouble
protected void finalize() throws IOException
{
if(fd >= 0)
this.close();
}
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=13499>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug-classpath] [bug #13499] gnu.java.nio.channels.FileChannelImpl finalize problem,
anonymous <=