Skip to content

Commit

Permalink
8318189: ChoiceFormat::format throws undocumented AIOOBE
Browse files Browse the repository at this point in the history
Reviewed-by: naoto
  • Loading branch information
Justin Lu committed Nov 12, 2023
1 parent 9938b3f commit caf7181
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/java.base/share/classes/java/text/ChoiceFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,18 @@ public Object[] getFormats() {

/**
* Specialization of format. This method really calls
* {@code format(double, StringBuffer, FieldPosition)}
* thus the range of longs that are supported is only equal to
* {@link #format(double, StringBuffer, FieldPosition)}.
* Thus, the range of longs that are supported is only equal to
* the range that can be stored by double. This will never be
* a practical limitation.
*
* @param number number to be formatted and substituted.
* @param toAppendTo where text is appended.
* @param status ignore no useful status is returned.
* @throws ArrayIndexOutOfBoundsException if either the {@code limits}
* or {@code formats} of this ChoiceFormat are empty
* @throws NullPointerException if {@code toAppendTo}
* is {@code null}
*/
@Override
public StringBuffer format(long number, StringBuffer toAppendTo,
Expand All @@ -488,9 +496,12 @@ public StringBuffer format(long number, StringBuffer toAppendTo,

/**
* Returns pattern with formatted double.
*
* @param number number to be formatted and substituted.
* @param toAppendTo where text is appended.
* @param status ignore no useful status is returned.
* @throws ArrayIndexOutOfBoundsException if either the {@code limits}
* or {@code formats} of this ChoiceFormat are empty
* @throws NullPointerException if {@code toAppendTo}
* is {@code null}
*/
Expand Down

0 comments on commit caf7181

Please sign in to comment.