-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.4.0
-
sparc
-
solaris_7
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)
----------------------------
-----------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)
----------------------------
- duplicates
-
JDK-4461202 java.nio package must be 64 bit clean
-
- Resolved
-
- relates to
-
JDK-4429213 gathering write operation returns -1
-
- Closed
-