See the following code,
var d = new ChoiceFormat("0#foo|1#bar|baz|")
d.format(1) // unexpectedly returns ""
It would have been preferable if either an exception was thrown when the ChoiceFormat was initially created, or the ChoiceFormat formatting 1 returned a value of bar.
For comparison,
var d = new ChoiceFormat("0#foo|1#bar|baz")
d.format(1) // returns "bar"
var d = new ChoiceFormat("0#foo|1#bar|baz|")
d.format(1) // unexpectedly returns ""
It would have been preferable if either an exception was thrown when the ChoiceFormat was initially created, or the ChoiceFormat formatting 1 returned a value of bar.
For comparison,
var d = new ChoiceFormat("0#foo|1#bar|baz")
d.format(1) // returns "bar"
- relates to
-
JDK-6801704 ChoiceFormat::applyPattern inconsistency for invalid patterns
- Closed