FileChannel.map() throws IOException for size=0

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 1.4.0
    • Affects Version/s: 1.4.0
    • Component/s: core-libs
    • beta2
    • sparc
    • solaris_7
    • Verified

      Per spec:
      size - The size of the region to be mapped; must be non-negative

      However,
      fc.map(FileChannel.MAP_RO, 0, 0) throws IOException.

      Implementation seems correct, and spec should say:
      size - The size of the region to be mapped; must be greater than 0.

      ------- results ------------
      On Solaris:
      ==========

      java.io.IOException: Invalid argument
              at sun.nio.ch.FileChannelImpl.map0(Native Method)
              at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:386)

      On Windows NT:
      =============
      java.io.IOException: The volume for a file has been externally altered such that the opened file is no longer valid
              at sun.nio.ch.FileChannelImpl.map0(Native Method)
              at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:386)

      -----------------

      Merlin Beta B-65

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: