-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.4.0
-
sparc
-
solaris_7
java.nio.FileChannel scattering read throws IOException with -d64 Flag.I tried with Solaris 7(64 bit). Please see the attached TestCase.
------------TestCase---------
// fc is FileChannel
try {
if (fc.position() != pos) {
return TestHelper.testFail(testName +
" FAIL : fc.postion() expected = " + pos +
", actual = " + fc.position());
}
// make the buffer ready for read operation
for (int i = 0 ; i < numBuffers ; i ++) {
dstBuffers[i].clear() ;
}
// perform read operation
// verify return value is correct
if ((bytesRead = fc.read(dstBuffers)) != TotalReadCapacity) {
return TestHelper.testFail(testName +
" FAIL (pos=" + pos + "): bytesRead expected = " + TotalReadCapacity +
", actual = " + bytesRead) ;
}
// for each buffer that received scattered data
for (int i = 0 ; i < numBuffers ; i ++) {
// verify that the buffer is completely filled up
// this also verfies claim made is spec: postion is
// guarateed to be equal to limit
if ( ! verifyBufferFullStatus(dstBuffers[i])) {
return TestHelper.testFail(testName +
" FAIL (pos=" + pos + "): dstBuffer[" + i +
"] doesn't appear full ! " + dstBuffers[i]) ;
}
// make the buffer ready for get operation
dstBuffers[i].flip() ;
// get data into the buffer
dstBuffers[i].get(dstData[i]) ;
//use only to demonstrate bug#4452020
//for (int j = 0 ; j < bufferCapacity ; j ++) {
// System.out.println(
// "dstData[" + pos + "," + i +"," + j +
// " ):" + dstData[i][j]) ;
//}
// verify data
for (int j = 0 ; j < bufferCapacity ; j ++) {
int thisByte = expectedDataByte + j + (bufferCapacity * i) ;
if (dstData[i][j] != thisByte) {
return TestHelper.testFail(testName +
" FAIL (" + pos + "," + i +"," + j +
"): byte expected = " + thisByte +
", actual = " + dstData[i][j]) ;
}
}
} // for int i ..
} catch (Exception e) {
return TestHelper.testFail(testName +
" FAIL (pos=" + pos + "): unexpected Exception!", e) ;
}
-------------------------------
--------------TestResults----------
java.io.IOException: Bad address
at sun.nio.ch.FileDispatcher.readv0(Native Method)
at sun.nio.ch.FileDispatcher.readv(FileDispatcher.java:38)
at sun.nio.ch.IOUtil.read(IOUtil.java:211)
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:101)
at ScatteringRead.readScatteringTest01(ScatteringRead.java:244)
at ScatteringRead.readScatteringTests(ScatteringRead.java:705)
at ScatteringRead.go(ScatteringRead.java:87)
at ScatteringRead.main(ScatteringRead.java:64)
-----------------------
------------TestCase---------
// fc is FileChannel
try {
if (fc.position() != pos) {
return TestHelper.testFail(testName +
" FAIL : fc.postion() expected = " + pos +
", actual = " + fc.position());
}
// make the buffer ready for read operation
for (int i = 0 ; i < numBuffers ; i ++) {
dstBuffers[i].clear() ;
}
// perform read operation
// verify return value is correct
if ((bytesRead = fc.read(dstBuffers)) != TotalReadCapacity) {
return TestHelper.testFail(testName +
" FAIL (pos=" + pos + "): bytesRead expected = " + TotalReadCapacity +
", actual = " + bytesRead) ;
}
// for each buffer that received scattered data
for (int i = 0 ; i < numBuffers ; i ++) {
// verify that the buffer is completely filled up
// this also verfies claim made is spec: postion is
// guarateed to be equal to limit
if ( ! verifyBufferFullStatus(dstBuffers[i])) {
return TestHelper.testFail(testName +
" FAIL (pos=" + pos + "): dstBuffer[" + i +
"] doesn't appear full ! " + dstBuffers[i]) ;
}
// make the buffer ready for get operation
dstBuffers[i].flip() ;
// get data into the buffer
dstBuffers[i].get(dstData[i]) ;
//use only to demonstrate bug#4452020
//for (int j = 0 ; j < bufferCapacity ; j ++) {
// System.out.println(
// "dstData[" + pos + "," + i +"," + j +
// " ):" + dstData[i][j]) ;
//}
// verify data
for (int j = 0 ; j < bufferCapacity ; j ++) {
int thisByte = expectedDataByte + j + (bufferCapacity * i) ;
if (dstData[i][j] != thisByte) {
return TestHelper.testFail(testName +
" FAIL (" + pos + "," + i +"," + j +
"): byte expected = " + thisByte +
", actual = " + dstData[i][j]) ;
}
}
} // for int i ..
} catch (Exception e) {
return TestHelper.testFail(testName +
" FAIL (pos=" + pos + "): unexpected Exception!", e) ;
}
-------------------------------
--------------TestResults----------
java.io.IOException: Bad address
at sun.nio.ch.FileDispatcher.readv0(Native Method)
at sun.nio.ch.FileDispatcher.readv(FileDispatcher.java:38)
at sun.nio.ch.IOUtil.read(IOUtil.java:211)
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:101)
at ScatteringRead.readScatteringTest01(ScatteringRead.java:244)
at ScatteringRead.readScatteringTests(ScatteringRead.java:705)
at ScatteringRead.go(ScatteringRead.java:87)
at ScatteringRead.main(ScatteringRead.java:64)
-----------------------
- duplicates
-
JDK-4461202 java.nio package must be 64 bit clean
-
- Resolved
-
- relates to
-
JDK-4420794 FileChannel.read() returns incorrect return value
-
- Closed
-
-
JDK-4452020 java.nio.FileChannel : Scattering Read gets incorrect data
-
- Closed
-