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

(fs) FileChannel.write(ByteBuffer[] srcs) throws IOException with -d64 Flag

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_7

      Description

      java.nio.FileChannel.write(ByteBuffer[] srcs) throws IOException with -d64 Flag , I tried on Solaris 7(64 bit) and solaris 8(64 bit) and this fails on both.

      -----------TestCase-----------------

      public boolean writeGatheringTest01() {
      String testName = "writeGatheringTest01" ;
      String fileName = testName + partialFileName ;
      int bufferCapacity = 3 ;
      int numBuffers = 3 ;
      int totalCapacity = bufferCapacity * numBuffers ;
      ByteBuffer[] srcBuffers = new ByteBuffer[numBuffers] ;
      FileChannel fc = Helper.openWriteFileChannel(new File(fileName));
      int bytesWritten = -10 ; // some invalid value
      if (fc == null) {
      TestHelper.testFail(testName + " FAIL ") ;
      }

      for (int i = 0 ; i < numBuffers ; i ++) {
      // initial position = 0, and limit = capacity
      srcBuffers[i] = ByteBuffer.allocate(bufferCapacity) ;
      // set limit = position = 0 (buffer empty)
      srcBuffers[i].flip();
      }

      try {

      // no data available in any of the buffers.
      // write() should write 0 bytes and return 0
      if ((bytesWritten = fc.write(srcBuffers)) != 0) {
      return TestHelper.testFail(testName +
      " FAIL: bytesWritten expected = 0" +
      ", actual = " + bytesWritten + ", pos = " + fc.position()) ;
      }
      } catch (Exception e) {
      return TestHelper.testFail(testName + " FAIL: unexpected exception ! ", e);

      }

      return TestHelper.testPass(testName + " PASS");

          }

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

      -------------TestResult----------------

      java.io.IOException: Bad address
      at sun.nio.ch.FileDispatcher.writev0(Native Method)
      at sun.nio.ch.FileDispatcher.writev(FileDispatcher.java:54)
      at sun.nio.ch.IOUtil.write(IOUtil.java:122)
      at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:135)
      at FCgatheringWrite.writeGatheringTest02(FCgatheringWrite.java:220)
      at FCgatheringWrite.go(FCgatheringWrite.java:74)
      at FCgatheringWrite.main(FCgatheringWrite.java:47)

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mmcclosksunw Michael Mccloskey (Inactive)
                Reporter:
                saksunw Sreejith Ak (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: