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

(fs) FileChannel.write(ByteBuffer src, long position) accepts position = -1

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.2
    • 1.4.1
    • core-libs
    • mantis
    • sparc
    • solaris_8
    • Verified

      build 14
      --------
      FileChannel.write(ByteBuffer src,long position) accepts position = -1 . Also the postion of filechannel is modified after the execution.
      It does not accept other non-negative values.

      outputs:
      if postion is -1
      ----------------
      byte written- > 1000
      size- > 1000
      position- > 1000 -->the postion is modified

      if postion is 1
      ----------------
      byte written- > 1000
      size- > 1001
      position- > 0

      if postion is -2
      -----------------
      FAIL java.io.IOException: Invalid argument
      java.io.IOException: Invalid argument
              at sun.nio.ch.FileDispatcher.pwrite0(Native Method)
              at sun.nio.ch.FileDispatcher.pwrite(FileDispatcher.java:45)
              at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:96)
              at sun.nio.ch.IOUtil.write(IOUtil.java:74)
              at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:609)
              at FCWrite.main(FCWrite.java:16)


      The testcase FCWrite.java is attached

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: