JDK-2181447 : (fc) FileChannel.tryLock leaves FileLock on lockList if I/O error occurs
  • Type: Backport
  • Backport of: JDK-6620010
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2009-08-07
  • Updated: 2011-02-16
  • Resolved: 2010-03-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 7
5.0u21-rev b02Fixed 7Resolved
Comments
SUGGESTED FIX --- src/share/classes/sun/nio/ch/FileChannelImpl.java_001 2009-08-07 16:45:41.026237257 +0400 +++ src/share/classes/sun/nio/ch/FileChannelImpl.java 2009-08-07 16:50:02.246184736 +0400 @@ -819,6 +819,7 @@ FileLockImpl fli = new FileLockImpl(this, position, size, shared); checkList(position, size); addList(fli); + try{ int result = lock0(fd, false, position, size, shared); if (result == NO_LOCK) { removeList(fli); @@ -833,6 +834,10 @@ return fli2; } return fli; + }catch(IOException e){ + removeList(fli); + throw e; + } } void release(FileLockImpl fli) throws IOException {
07-08-2009

EVALUATION Lock table entry isn't removed on exception.
07-08-2009