FULL PRODUCT VERSION :
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Printing of two or more "special" chars using System.out.print() one char at a time produces java.lang.Error. For example, print '\uda00' twice. Error doesn't occure with println() method.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.Error
at sun.nio.cs.StreamEncoder$CharsetSE.flushLeftoverChar(StreamEncoder.java:361)
at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(StreamEncoder.java:381)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:191)
at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)
at java.io.PrintStream.write(PrintStream.java:458)
at java.io.PrintStream.print(PrintStream.java:602)
at PrintCharsBug.main(PrintCharsBug.java:4)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class PrintCharsBug {
public static void main(String[] args) {
System.out.print("\uda00");
System.out.print("\uda01");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use StringBuffer to append chars and than print it.
Or print all chars at once: System.out.print("\uda00\uda00");
###@###.### 2005-05-24 06:23:18 GMT
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Printing of two or more "special" chars using System.out.print() one char at a time produces java.lang.Error. For example, print '\uda00' twice. Error doesn't occure with println() method.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.Error
at sun.nio.cs.StreamEncoder$CharsetSE.flushLeftoverChar(StreamEncoder.java:361)
at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(StreamEncoder.java:381)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:191)
at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)
at java.io.PrintStream.write(PrintStream.java:458)
at java.io.PrintStream.print(PrintStream.java:602)
at PrintCharsBug.main(PrintCharsBug.java:4)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class PrintCharsBug {
public static void main(String[] args) {
System.out.print("\uda00");
System.out.print("\uda01");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use StringBuffer to append chars and than print it.
Or print all chars at once: System.out.print("\uda00\uda00");
###@###.### 2005-05-24 06:23:18 GMT
- duplicates
-
JDK-4912159 (cs) Stream encoder handles split malformed surrogates incorrectly
-
- Closed
-
- relates to
-
JDK-4744247 (cs) StreamDecoder.CharsetSD.read does not invoke CharsetDecoder.flush
-
- Open
-