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

(fs) Cannot map from file channel after position 65535

XMLWordPrintable

    • beta2
    • x86, sparc
    • solaris_7, windows_2000
    • Verified



      Name: bsC130419 Date: 07/20/2001


      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)


      Obtain a channel for a file over 65336 bytes in length. Create a
      MappedByteBuffer from the channel, in any mode, with a starting position of at
      least 65536. This action causes an IOException, "Access is denied", even if the
      file is large enough for the mapping to definitely succeed.

      import java.io.*;
      import java.nio.channels.*;

      public class MapTest {
          public static void main(String[] args) throws Exception {
              RandomAccessFile raf = new RandomAccessFile(args[0], "r");
              FileChannel channel = raf.getChannel();
              channel.map(FileChannel.MAP_RO, 65536, 100);
          }
      }

      java MapTest testfile

      Exception in thread "main" java.io.IOException: Access is denied
              at sun.nio.ch.FileChannelImpl.map0(Native Method)
              at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:386)
              at MapTest.main(MapTest.java:8)
      (Review ID: 128527)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            bstrathesunw Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: