-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6u29
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Server VM (build 20.4-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux r70 2.6.37.6-0.9-desktop #1 SMP PREEMPT 2011-10-19 22:33:27 +0200 i686 i686 i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
According to the java.io.PrintWriter documentation after the setError() method is called the checkError() method should return "true". It does not work so starting with JRE 1.6.
Here is a simple test (TestPrintWriter.java) that illustrates the problem.
import java.io.PrintWriter;
import java.io.OutputStream;
public class TestPrintWriter {
static class MyPrintWriter extends PrintWriter {
public MyPrintWriter(OutputStream out) {
super(out);
}
public void myMethod() {
setError();
}
}
public static void main(String[] args) {
MyPrintWriter pw = new MyPrintWriter(System.out);
pw.myMethod(); // myMethod sets an error
if (pw.checkError())
System.out.println("Test passed");
else
System.out.println("Test failed");
}
}
Here are results of running the test with Java 1.5 and 1.6
/u01/osv > /usr/lib/jvm/java-1.5.0-sun-1.5.0/bin/java -cp . TestPrintWriter
Test passed
/u01/osv > /usr/lib/jvm/java-1.6.0-sun-1.6.0/bin/java -cp . TestPrintWriter
Test failed
REGRESSION. Last worked in version 5.0
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.PrintWriter;
import java.io.OutputStream;
public class TestPrintWriter {
static class MyPrintWriter extends PrintWriter {
public MyPrintWriter(OutputStream out) {
super(out);
}
public void myMethod() {
setError();
}
}
public static void main(String[] args) {
MyPrintWriter pw = new MyPrintWriter(System.out);
pw.myMethod(); // myMethod sets an error
if (pw.checkError())
System.out.println("Test passed");
else
System.out.println("Test failed");
}
}
---------- END SOURCE ----------
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Server VM (build 20.4-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux r70 2.6.37.6-0.9-desktop #1 SMP PREEMPT 2011-10-19 22:33:27 +0200 i686 i686 i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
According to the java.io.PrintWriter documentation after the setError() method is called the checkError() method should return "true". It does not work so starting with JRE 1.6.
Here is a simple test (TestPrintWriter.java) that illustrates the problem.
import java.io.PrintWriter;
import java.io.OutputStream;
public class TestPrintWriter {
static class MyPrintWriter extends PrintWriter {
public MyPrintWriter(OutputStream out) {
super(out);
}
public void myMethod() {
setError();
}
}
public static void main(String[] args) {
MyPrintWriter pw = new MyPrintWriter(System.out);
pw.myMethod(); // myMethod sets an error
if (pw.checkError())
System.out.println("Test passed");
else
System.out.println("Test failed");
}
}
Here are results of running the test with Java 1.5 and 1.6
/u01/osv > /usr/lib/jvm/java-1.5.0-sun-1.5.0/bin/java -cp . TestPrintWriter
Test passed
/u01/osv > /usr/lib/jvm/java-1.6.0-sun-1.6.0/bin/java -cp . TestPrintWriter
Test failed
REGRESSION. Last worked in version 5.0
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.PrintWriter;
import java.io.OutputStream;
public class TestPrintWriter {
static class MyPrintWriter extends PrintWriter {
public MyPrintWriter(OutputStream out) {
super(out);
}
public void myMethod() {
setError();
}
}
public static void main(String[] args) {
MyPrintWriter pw = new MyPrintWriter(System.out);
pw.myMethod(); // myMethod sets an error
if (pw.checkError())
System.out.println("Test passed");
else
System.out.println("Test failed");
}
}
---------- END SOURCE ----------