Fails on Window NT / Windows ME. Works on Solaris and Linux.
Merlin Beta build B-58.
------- part of test code -------------
byte[] dstData ;
FileChannel fc ;
String fileName = "test.data" ;
File file ;
byte[] srcData = Helper.getRandomByteArray(MIN_DATA_SIZE, MAX_DATA_SIZE);
try {
file = new File(fileName);
// get filechannel for the file.
fc = Helper.openWriteFileChannel(file) ;
fc.write(ByteBuffer.wrap(srcData));
fc.force(false);
fc.write(ByteBuffer.wrap(srcData)); // << throws IOException
} catch (IOException e) {
return TestHelper.testFail(testName + " FAIL: Unexpected Exception",
e);
}
--------- results -------------------
H:\test\FCforce>java FCforce
forceTest01 FAIL: Unexpected Exception
java.io.IOException: The handle is invalid
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.FileDispatcher.write(FileDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:60)
at sun.nio.ch.IOUtil.write(IOUtil.java:42)
at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:99)
at FCforce.forceTest01(FCforce.java:142)
:
:
----------------------------------------
Merlin Beta build B-58.
------- part of test code -------------
byte[] dstData ;
FileChannel fc ;
String fileName = "test.data" ;
File file ;
byte[] srcData = Helper.getRandomByteArray(MIN_DATA_SIZE, MAX_DATA_SIZE);
try {
file = new File(fileName);
// get filechannel for the file.
fc = Helper.openWriteFileChannel(file) ;
fc.write(ByteBuffer.wrap(srcData));
fc.force(false);
fc.write(ByteBuffer.wrap(srcData)); // << throws IOException
} catch (IOException e) {
return TestHelper.testFail(testName + " FAIL: Unexpected Exception",
e);
}
--------- results -------------------
H:\test\FCforce>java FCforce
forceTest01 FAIL: Unexpected Exception
java.io.IOException: The handle is invalid
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.FileDispatcher.write(FileDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:60)
at sun.nio.ch.IOUtil.write(IOUtil.java:42)
at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:99)
at FCforce.forceTest01(FCforce.java:142)
:
:
----------------------------------------