-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
beta2
-
generic
-
generic
The ISO2022CN and ISO2022KR converters do not handle invalid escape sequences correctly. They throw an ArrayIndexOutOfBoundsException when illegal/malformed
escapes are encountered within an input stream. Note: This is one of a number
of bugs resulting from a distillation of BugID 4296969, Incorrect behaviour of
several character converters.
The following test case will demonstrate this behaviour:
/*
* Runtime exceptions generated when illegal ISO2022 escapes
* are provided within an input stream to be decoded
*/
public class InvalidEscapes {
public static void main(String[] args){
for (int i = 0; i < encodings.length; i++){
test(encodings[i]);
}
try {
byte[] bb = new byte[] {(byte)0x1b, (byte)')', (byte)'x'};
String str = new String(bb,"ISO2022CN");
} catch (Throwable th){
System.err.println("ISO2022CN error " + th);
}
try {
byte[] bb = new byte[] {(byte)0x1b, (byte)')', (byte)'x'};
String str = new String(bb,"ISO2022KR");
} catch (Throwable th){
System.err.println("ISO2022KR error " + th);
}
}
}
Ian.Little@Irleland 3/23/2001.
escapes are encountered within an input stream. Note: This is one of a number
of bugs resulting from a distillation of BugID 4296969, Incorrect behaviour of
several character converters.
The following test case will demonstrate this behaviour:
/*
* Runtime exceptions generated when illegal ISO2022 escapes
* are provided within an input stream to be decoded
*/
public class InvalidEscapes {
public static void main(String[] args){
for (int i = 0; i < encodings.length; i++){
test(encodings[i]);
}
try {
byte[] bb = new byte[] {(byte)0x1b, (byte)')', (byte)'x'};
String str = new String(bb,"ISO2022CN");
} catch (Throwable th){
System.err.println("ISO2022CN error " + th);
}
try {
byte[] bb = new byte[] {(byte)0x1b, (byte)')', (byte)'x'};
String str = new String(bb,"ISO2022KR");
} catch (Throwable th){
System.err.println("ISO2022KR error " + th);
}
}
}
Ian.Little@Irleland 3/23/2001.
- relates to
-
JDK-4296969 Incorrect behaviours of several character converters
-
- Closed
-