< prev index next >

src/java.base/share/classes/java/text/MessageFormat.java

Print this page

        

*** 699,708 **** --- 699,712 ---- * @param newFormat the format to use for the specified format element * @exception ArrayIndexOutOfBoundsException if {@code formatElementIndex} is equal to or * larger than the number of format elements in the pattern string */ public void setFormat(int formatElementIndex, Format newFormat) { + + if (formatElementIndex > maxOffset) { + throw new ArrayIndexOutOfBoundsException(formatElementIndex); + } formats[formatElementIndex] = newFormat; } /** * Gets the formats used for the values passed into
< prev index next >