Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4486154

(fs) FileChannel.lock/tryLock throw IOException when not open for read & write

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • core-libs
    • beta3
    • sparc
    • solaris_8
    • Verified

      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.

            mmcclosksunw Michael Mccloskey (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: