-
Bug
-
Resolution: Fixed
-
P2
-
5.0
-
b58
-
x86
-
windows_2000
Name: rmT116609 Date: 06/02/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows2000 SP4 Japanese Version
A DESCRIPTION OF THE PROBLEM :
The decoder of "JISAutoDetect" contains a bug.
When I tried to read from InputStreamReader which encode is "JISAutoDetect", it continues reading forever or can't read at all.
I could read perfectly when I used "Shift_JIS" encode.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to execute the sample code like this.
>java ReaderTest <the file name to read>
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Shows the contents of the file.
ACTUAL -
There are 2 result.
1, When it reaches the end of the file, it starts reading from the beginning of the file and continues showing the file content forever.
2, Throws an exeption. I wrote the stack trace below.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.io.IOException: Underlying input stream returned zero bytes
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at ReaderTest.main(ReaderTest.java:11)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
public class ReaderTest {
public static void main(String[] args) {
try {
File file = new File(args[0]);
FileInputStream fis = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(fis, "JISAutoDetect");
BufferedReader reader = new BufferedReader(isr);
String line;
while((line = reader.readLine()) != null) {
System.out.println(line);
}
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 275694)
======================================================================
- relates to
-
JDK-5053096 JISAutoDetect outputs bufferOverFlowException in 1.5-beta2-b51
- Resolved
-
JDK-4997240 SQA: 1 servlet2.3 failure with b55 +j2se1.5+win2003ser
- Resolved