On Tue, 18 Jul 2023 20:48:13 GMT, Justin Lu <j...@openjdk.org> wrote:
>> Please review this PR and [CSR](https://bugs.openjdk.org/browse/JDK-8312197) >> which updates the javadoc for the constructor of MessageFormat regarding a >> `null` locale, >> >> `MessageFormat` when created with a `null` locale may throw a >> `NullPointerException` either during the object creation, or later when >> `format()` is called by the `MessageFormat` object (test file has examples >> of both). This change updates the specification of MessageFormat to make >> this apparent. The wording is specifically chosen as 'may throw' since >> whether an NPE is thrown depends on the subformat used by MessageFormat (see >> test example of construction with null locale and no exception thrown). >> >> The test for this change was merged with `Bug6481179.java` into >> `MessageFormatExceptions.java` (As they both test exceptions). In addition, >> some other exception testing regarding MessageFormat was added. >> >> Thanks > > Justin Lu has updated the pull request incrementally with two additional > commits since the last revision: > > - Slight wording adjustment > - Review: Explicitly declare when NPE thrown instead of 'may' src/java.base/share/classes/java/text/MessageFormat.java line 398: > 396: * when {@code format()} is called by the constructed {@code > MessageFormat} > 397: * instance and the implementation utilizes a subformat that requires > 398: * localization. Sorry for the nitpick, but since localization itself is not a requirement, `locale-dependent subformat` would read better to me. (and wherever `localized` is used) src/java.base/share/classes/java/text/MessageFormat.java line 407: > 405: * @throws NullPointerException This method throws a > 406: * {@code NullPointerException} if {@code locale} is > {@code null} > 407: * and a localized subformat is used. NPE throws tags should be combined. Applies to other locations too. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14911#discussion_r1267346080 PR Review Comment: https://git.openjdk.org/jdk/pull/14911#discussion_r1267347900