|
Quick Lists
|
|
Bug ID:
|
4404854
|
|
Votes
|
0
|
|
Synopsis
|
(cs) jdk regression: InputStreamReader.skip(int) raises unexpected exception
|
|
Category
|
java:classes_io
|
|
Reported Against
|
merlin
|
|
Release Fixed
|
1.4(merlin-beta3)
|
|
State
|
10-Fix Delivered,
Verified,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
4503732
,
4403272
|
|
Submit Date
|
16-JAN-2001
|
|
Description
|
Method java.io.InputStreamReader.skip(int) raises java.lang.Error instead of
IOException when ByteArrayInputStream is empty.
In jdk1.3 this method throws IOException in this case.
Here is the test demonstrating the bug:
------------------- t.java -------------
import java.io.*;
public class t{
public static void main(String [] args) {
byte[] bytes = { (byte)128 };
char[] readChars = new char[10];
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
InputStreamReader isr = null;
try {
isr = new InputStreamReader(bais, "UTF8");
} catch(UnsupportedEncodingException e){
System.out.println("Unexpected exception");
return;
}
try {
isr.skip(1);
} catch (IOException ioe) {
System.out.println("IOException was thrown as expected");
return;
}
System.out.println("read should have thrown IOException");
}
}
----------- output from the test: --------------------
#> java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b46)
Java HotSpot(TM) Client VM (build 1.4beta-B45, mixed mode)
#> java t
Exception in thread "main" java.lang.Error
at java.io.InputStreamReader$CharsetFiller.fill(InputStreamReader.java:353)
at java.io.InputStreamReader.read(InputStreamReader.java:478)
at java.io.Reader.skip(Reader.java:148)
at t.main(t.java:17)
#> java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)
#> java t
IOException was thrown as expected
======================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
That this test was seeing an error thrown was fixed by 4503732.
Note that the test itself is incorrect; it's expecting an IOException to be
thrown for invalid UTF-8 data, which is not guaranteed by the specification
(see 4403272).
-- xxxxx@xxxxx 2001/9/28
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |