-
Bug
-
Resolution: Won't Fix
-
P2
-
None
-
1.3.1_22
-
x86
-
windows_vista
jdk: 131 u22 b01
test machine: stt-53.russia.sun.com (Win2008 x86), stt-47.russia.sun.com (WinVista x86)
test suite: 131
test case where regression was found: libs_api_tests/common/java_io/PipedWriter/flushTests
Test case failed on WinVista and Win2008 but passed on WinXP.
These tests check if the PipedWriter flush method works correctly. But doesn't work correctly instance of "File" class already.
See some code, please:
......
File f = new File(sBaseDir+File.separator+fileName);
FileWriter out = new FileWriter(sBaseDir+File.separator+fileName);
try {
for (int j = 0; j < 10; j++) {
sOutput = j + " \n";
out.write(sOutput);
out.flush();
Thread.sleep(1000);
}
} catch (IOException e) {
e.printStackTrace();
}
if (f.length() > 0) {
System.out.println("Test Passed");
} else {
System.out.println("Test Failed"); }
......
As you can see the test case failed if "f.length() == 0". This method returns the length of the file denoted by this abstract pathname.
On WinVista and Win2008 this code always return "Test Failed". On Win XP it always passed.
But output file always created (on Vista and 2008 too) and thick with data.
So, it looks like on WinVista and Win2008 the instance of class "File" can't determinate the length of file after flushing in it from buffers of "FileWriter" instance.
For reproducing:
compile
C:\JDK\jdk1.3.1_22\bin\javac flushTests.java // for example
and execute
C:\JDK\jdk1.3.1_22\bin\java flushTests
attached java file on WinVista or Win2008 x86.
test machine: stt-53.russia.sun.com (Win2008 x86), stt-47.russia.sun.com (WinVista x86)
test suite: 131
test case where regression was found: libs_api_tests/common/java_io/PipedWriter/flushTests
Test case failed on WinVista and Win2008 but passed on WinXP.
These tests check if the PipedWriter flush method works correctly. But doesn't work correctly instance of "File" class already.
See some code, please:
......
File f = new File(sBaseDir+File.separator+fileName);
FileWriter out = new FileWriter(sBaseDir+File.separator+fileName);
try {
for (int j = 0; j < 10; j++) {
sOutput = j + " \n";
out.write(sOutput);
out.flush();
Thread.sleep(1000);
}
} catch (IOException e) {
e.printStackTrace();
}
if (f.length() > 0) {
System.out.println("Test Passed");
} else {
System.out.println("Test Failed"); }
......
As you can see the test case failed if "f.length() == 0". This method returns the length of the file denoted by this abstract pathname.
On WinVista and Win2008 this code always return "Test Failed". On Win XP it always passed.
But output file always created (on Vista and 2008 too) and thick with data.
So, it looks like on WinVista and Win2008 the instance of class "File" can't determinate the length of file after flushing in it from buffers of "FileWriter" instance.
For reproducing:
compile
C:\JDK\jdk1.3.1_22\bin\javac flushTests.java // for example
and execute
C:\JDK\jdk1.3.1_22\bin\java flushTests
attached java file on WinVista or Win2008 x86.