JDK-4486154 : (fs) FileChannel.lock/tryLock throw IOException when not open for read & write
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2001-07-30
  • Updated: 2001-10-04
  • Resolved: 2001-10-03
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
1.4.0 beta3Fixed
Related Reports
Relates :  
Relates :  
Description
java.io.IOException: Bad file number

is thrown when lock(), tryLock(), lock(0,size,false) and tryLock(0,size,false) are called. (Since for lock() and tryLock() default lock is exclusive)

try {
  File blah = new File("blah");
  FileInputStream fis = new FileInputStream(blah);
  FileChannel       c = fis.getChannel();
  FileLock fl = c.tryLock(0,c.size(),false);
  //FileLock fl = c.tryLock(0,c.size(),true);
} catch (Exception e) {
  e.printStackTrace();
}


###@###.### 2001-10-03
Implementation part has been done, but the spec for lock(), trylock() has not 
been updated to reflect the same. Therefore removing this bug from the Integrated state.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic merlin-beta3 FIXED IN: merlin-beta2 merlin-beta3 INTEGRATED IN: merlin-beta3 VERIFIED IN: merlin-beta3
14-06-2004

PUBLIC COMMENTS bug#4510562 is tracking the required spec change.
10-06-2004

EVALUATION The test tries to get an exclusive lock without write permission. The spec should be clarified on this point. michael.mccloskey@eng 2001-08-01 Associated spec changes are being tracked by 4510562. -- ###@###.### 2001/10/3
01-08-2001