-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.4.2
-
x86
-
windows_xp
Name: rmT116609 Date: 07/21/2004
FULL PRODUCT VERSION :
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
With the following sample, if it is going to change into String Object from a byte sequence, an exception( java.lang.IllegalArgumentException ) will occur. Originally it changes into REPLACEMENT CHARACTER ?
import java.io.UnsupportedEncodingException;
public class EUC_JP_LinuxTest {
/**
*
* @param str
* @throws Exception
*/
public static void main(String[] str) throws Exception {
byte b[][] =
{{(byte) 0x8f, (byte) 0xa2, (byte) 0xb7},};//JISX2012 CHARACTER
String[] testencoding = {
"EUC_JP_LINUX",
};
int len = testencoding.length;
for (int i = 0; i < len; i++) {
String[] s = createStringArray(b, testencoding[i]);
}
}
/**
* @param b
* @param encode
* @param lens
* @return @throws
* UnsupportedEncodingException
*/
private static String[] createStringArray(byte[][] b, String encode)
throws UnsupportedEncodingException {
int lens = b.length;
String[] s = new String[lens];
for (int i = 0; i < lens; i++) {
s[i] = new String(b[i], encode);
}
return s;
}
}
----
java.lang.IllegalArgumentException
at java.nio.Buffer.position(Buffer.java:218)
at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:575)
at java.lang.StringCoding$CharsetSD.decode(StringCoding.java:186)
at java.lang.StringCoding.decode(StringCoding.java:224)
at java.lang.String.<init>(String.java:320)
at java.lang.String.<init>(String.java:346)
at EUC_JP_LinuxTest.createStringArray(EUC_JP_LinuxTest.java:39)
at EUC_JP_LinuxTest.main(EUC_JP_LinuxTest.java:22)
Exception in thread "main"
REPRODUCIBILITY :
This bug can be reproduced always.
(Incident Review ID: 284806)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP
A DESCRIPTION OF THE PROBLEM :
With the following sample, if it is going to change into String Object from a byte sequence, an exception( java.lang.IllegalArgumentException ) will occur. Originally it changes into REPLACEMENT CHARACTER ?
import java.io.UnsupportedEncodingException;
public class EUC_JP_LinuxTest {
/**
*
* @param str
* @throws Exception
*/
public static void main(String[] str) throws Exception {
byte b[][] =
{{(byte) 0x8f, (byte) 0xa2, (byte) 0xb7},};//JISX2012 CHARACTER
String[] testencoding = {
"EUC_JP_LINUX",
};
int len = testencoding.length;
for (int i = 0; i < len; i++) {
String[] s = createStringArray(b, testencoding[i]);
}
}
/**
* @param b
* @param encode
* @param lens
* @return @throws
* UnsupportedEncodingException
*/
private static String[] createStringArray(byte[][] b, String encode)
throws UnsupportedEncodingException {
int lens = b.length;
String[] s = new String[lens];
for (int i = 0; i < lens; i++) {
s[i] = new String(b[i], encode);
}
return s;
}
}
----
java.lang.IllegalArgumentException
at java.nio.Buffer.position(Buffer.java:218)
at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:575)
at java.lang.StringCoding$CharsetSD.decode(StringCoding.java:186)
at java.lang.StringCoding.decode(StringCoding.java:224)
at java.lang.String.<init>(String.java:320)
at java.lang.String.<init>(String.java:346)
at EUC_JP_LinuxTest.createStringArray(EUC_JP_LinuxTest.java:39)
at EUC_JP_LinuxTest.main(EUC_JP_LinuxTest.java:22)
Exception in thread "main"
REPRODUCIBILITY :
This bug can be reproduced always.
(Incident Review ID: 284806)
======================================================================