ChoiceFormat can be created with incomplete limits and formats via applyPattern() or setChoices(). Calling format() with those objects throws an AIOOBE
For example, (the constructors invoke the mentioned setter methods)
new ChoiceFormat("").format(1); // throws AIOOBE
new ChoiceFormat(new double[]{}, new String[]{}).format(1); // throws AIOOBE
It would be great if the setter methods could have made input checks, but for compatibility reasons this cannot be done. At a minimum, the undocumented AIOOBE should be clarified.
For example, (the constructors invoke the mentioned setter methods)
new ChoiceFormat("").format(1); // throws AIOOBE
new ChoiceFormat(new double[]{}, new String[]{}).format(1); // throws AIOOBE
It would be great if the setter methods could have made input checks, but for compatibility reasons this cannot be done. At a minimum, the undocumented AIOOBE should be clarified.
- csr for
-
JDK-8318191 ChoiceFormat::format throws undocumented AIOOBE
- Closed