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

(fs) FileChannel.transferTo() fails on Windows 98

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • beta3
    • sparc
    • solaris_7
    • Verified

      ------------- test code ---------------
          public boolean xferTest02() {
      String testName = "xferTest02" ;
      byte[] dstData ;
      long fileLength ;
      FileChannel fc1, fc2 ;
      MappedByteBuffer b ;

      String srcFileName = "src." + testName ;
      String dstFileName = "dst." + testName ;

      byte[] srcData = Helper.getRandomByteArray(MIN_DATA_SIZE, MAX_DATA_SIZE);
      try {
      int bytesWritten ;
      int bytesToWrite ;
      int startPosition ;

      // get filechannel for the source file.
      fc1 = Helper.openRWFileChannel(srcFileName) ;
      // write out data to the file channel
      bytesWritten = fc1.write(ByteBuffer.wrap(srcData)) ;

      // get filechannel for the dst file.
      fc2 = Helper.openRWFileChannel(dstFileName) ;
      bytesToWrite = srcData.length/2 ;
      startPosition = srcData.length/4 ;
      System.out.println("srcData.length=" + srcData.length
                            + ", bytesToWrite=" + bytesToWrite
                            + ", startPosition=" + startPosition);

      bytesWritten = fc1.transferTo(startPosition, bytesToWrite, fc2); // <<< fails here


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

      }
          }

      ---------- result on windows 98 -------------

      H:> java FCtransferTo

      srcData.length=4984, bytesToWrite=2492, startPosition=1246

      xferTest02 FAIL: Unexpected Exception
      java.io.IOException
      at sun.nio.ch.FileChannelImpl.unmap0(Native Method)
      at sun.nio.ch.FileChannelImpl.unmap(FileChannelImpl.java:414)
      at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:272)
      at FCtransferTo.xferTest02(FCtransferTo.java:216)
      -------------------

      Works OK on Solaris.

      build 1.4.0-beta_refresh-b72

            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: