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

API method FileChannel.lock() works wrong in SuSE SLES 8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 5.0
    • core-libs
    • generic
    • linux_suse_sles_8

      Platform: i586, AMD64
      OS: SuSE SLES 8 (x86 & AMD64), SuSE Linux 8.2 (i586)

      Fix for Bug# 4854085 did not fix the problem in SuSE Linux. Running the following code throws IOException.

      -------------------- test.java ----------------------
      import java.io.*;
      import java.nio.channels.*;
      public class test {
          public static void main(String[] args) {
      FileLock fl = null;
      try {
      FileOutputStream fos = new FileOutputStream("testFile.tmp");
      fos.write(new byte[128]);
                  FileChannel ch = fos.getChannel();
      fl = ch.lock();
              } catch (IOException e) {
      System.out.println("Unexpected exception: "+e);
                  e.printStackTrace();
      System.exit(0);
              }
              System.out.println("PASSED.");
          }
      }
      ------------------- example output ------------------

      scorpius$% uname -a
      Linux scorpius 2.4.20-4GB #1 Mon Mar 17 17:54:44 UTC 2003 i686 unknown unknown GNU/Linux
      scorpius$%
      scorpius$% cat /etc/SuSE-release
      SuSE Linux 8.2 (i586)
      VERSION = 8.2
      scorpius$% /net/koori/onestop/jdk/1.5.0/latest/binaries/linux-i586/bin/java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b26)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b26, mixed mode)
      scorpius$%
      scorpius$% /net/koori/onestop/jdk/1.5.0/latest/binaries/linux-i586/bin/java testUnexpected exception: java.io.IOException: No locks available
      java.io.IOException: No locks available
      at sun.nio.ch.FileChannelImpl.lock0(Native Method)
      at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:778)
      at java.nio.channels.FileChannel.lock(FileChannel.java:865)
      at test.main(test.java:10)
      scorpius$%
      --------------------------------------------------------------

      please fix this

      ###@###.### 2003-11-03

            mmcclosksunw Michael Mccloskey (Inactive)
            aramanatsunw Ashwin Ramanathan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: