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

(fs) FileChannel.map() fails on Windows NT when position !=0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.0
    • core-libs
    • sparc
    • solaris_7

      ---------------- test code ----------------------------
      FileChannel fc ;
      MappedByteBuffer b ;
      byte[] srcData = Helper.getRandomByteArray(MIN_DATA_SIZE, MAX_DATA_SIZE);
      // start at 25% of buffer, and map 75% of total size
      int offset = srcData.length/2 - srcData.length/4 ;
      int mapSize = srcData.length/2 + srcData.length/4 ;

      try {
      fc = Helper.openRWTempFileChannel(fileName) ;
      fc.write(ByteBuffer.wrap(srcData));
      System.out.println("offset=" + offset + ", mapSize=" + mapSize);
      b = fc.map(FileChannel.MAP_RW, offset, mapSize);
      System.out.println(b);

      } catch (IOException e) {
      return TestHelper.testFail(testName + " FAIL: Unexpected Exception", e);

      }

      --------- results on Windows NT ------------
      java FCmap^M
      :
      offset=1206060, mapSize=3618180^M
      mapTest02 (file size=4824241) FAIL: Unexpected Exception^M
      java.io.IOException: Access is denied^M
      at sun.nio.ch.FileChannelImpl.map0(Native Method)^M
      at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:399)^M
      at FCmap.mapTest02(FCmap.java:323)^M
      :
      ---------------------
      Works fine on Solaris and Linux.

      Merlin Build B-73.


            mmcclosksunw Michael Mccloskey (Inactive)
            hvilekar Harshad Vilekar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: