-
Bug
-
Resolution: Fixed
-
P2
-
1.4.1
-
rc
-
x86
-
windows_2000
-
Verified
###@###.### 2002-06-05
J2SE Version (please include all output from java -version flag):
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b12)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b12, mixed mode)
Does this problem occur on J2SE 1.3 or 1.4? Yes / No (pick one)
No. works fine with 1.4.0 and 1.4.1 build10.
Operating System Configuration Information (be specific):
Windows 2000 SP2 and also on Linux
Hardware Configuration Information (be specific):
Intel
Bug Description:
Program loops and prints out zeros, need to kill it.
According to help, read() should block, until some data is available!
Steps to Reproduce (be specific):
java -Dhttp.proxyHost=scaweb1 -Dhttp.proxyPort=8080 Untitled1
This is the output with 1.4.0 release (b92) and 1.4.1 build10:
4096
4096
4096
3808
And with 1.4.1 b12:
4096
4096
2998
0
0
0
0
... and need to kill it, as zeros go on for ever. It means that
read() method returns zero bytes - according to documentation, this
should never happen.
Test program:
-------------
import java.net.*;
import java.io.*;
public class Untitled1 {
public static void main(String[] args) {
try {
URL url = new URL("http://www.redstar-lj.com/manual/howto/cgi.html.ja.jis");
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len;
InputStream in = url.openConnection().getInputStream();
try {
byte[] b = new byte[4096];
while ( ( len = in.read( b, 0, b.length ) ) != -1 ) {
out.write(b, 0, len);
}
} finally {
in.close();
}
Reader inR = new InputStreamReader(new ByteArrayInputStream(out.toByteArray()), "iso-2022-jp");
try {
char[] c = new char[4096];
while ( ( len = inR.read( c, 0, c.length ) ) != -1 ) {
System.out.println(len);
}
} finally {
inR.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
- relates to
-
JDK-4701089 NIO ISO-2022-JP charset decoder breaks with some input buffers.
-
- Closed
-