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

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 1.4.0
    • Affects Version/s: 1.4.0
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: