FULL PRODUCT VERSION :
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux leeloo 2.6.8-2-k7 #1 Thu May 19 18:03:29 JST 2005 i686 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Parsing a ChoiceFormat with one of the characters
* <
* #
* \u2264
fails with IllegalArgumentException although this is not necessary. The reason is this code in ChoiceFormat.java:183
} else if (ch == '<' || ch == '#' || ch == '\u2264') {
it checks for on of the special characters in the format. But it does this even in the 'body'-part of the pattern, i.e. the text to display. A fix would be to extend the if-clause to which part the special character is in and only run it if it is in the first part, i.e. choice-condition.
} else if (part == 0 && ch == '<' || ch == '#' || ch == '\u2264') {
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just run one of these commands:
new java.text.ChoiceFormat("0#<");
new java.text.ChoiceFormat("0#a<b");
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ChoiceFormat accepts '<', '#', '\u2264' in the body.
ACTUAL -
IllegalArgumentException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException
at java.text.ChoiceFormat.applyPattern(ChoiceFormat.java:197)
at java.text.ChoiceFormat.<init>(ChoiceFormat.java:294)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
public static void main(String[] args) {
new java.text.ChoiceFormat("0#<");
}
}
---------- END SOURCE ----------
###@###.### 2005-06-15 11:42:34 GMT
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux leeloo 2.6.8-2-k7 #1 Thu May 19 18:03:29 JST 2005 i686 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Parsing a ChoiceFormat with one of the characters
* <
* #
* \u2264
fails with IllegalArgumentException although this is not necessary. The reason is this code in ChoiceFormat.java:183
} else if (ch == '<' || ch == '#' || ch == '\u2264') {
it checks for on of the special characters in the format. But it does this even in the 'body'-part of the pattern, i.e. the text to display. A fix would be to extend the if-clause to which part the special character is in and only run it if it is in the first part, i.e. choice-condition.
} else if (part == 0 && ch == '<' || ch == '#' || ch == '\u2264') {
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just run one of these commands:
new java.text.ChoiceFormat("0#<");
new java.text.ChoiceFormat("0#a<b");
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ChoiceFormat accepts '<', '#', '\u2264' in the body.
ACTUAL -
IllegalArgumentException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException
at java.text.ChoiceFormat.applyPattern(ChoiceFormat.java:197)
at java.text.ChoiceFormat.<init>(ChoiceFormat.java:294)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
public static void main(String[] args) {
new java.text.ChoiceFormat("0#<");
}
}
---------- END SOURCE ----------
###@###.### 2005-06-15 11:42:34 GMT
- csr for
-
JDK-8314822 ChoiceFormat can support unescaped relational symbols in the Format segment
-
- Closed
-
- relates to
-
JDK-6228794 java.text.ChoiceFormat pattern behavior is not well documented.
-
- Resolved
-