<i18n dev> RFR: 8039165: [Doc] MessageFormat null locale generates NullPointerException [v2]

Justin Lu jlu at openjdk.org
Tue Jul 18 20:48:13 UTC 2023


> 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'

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/14911/files
  - new: https://git.openjdk.org/jdk/pull/14911/files/05ac9193..4092e3ad

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14911&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14911&range=00-01

  Stats: 14 lines in 2 files changed: 10 ins; 1 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/14911.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14911/head:pull/14911

PR: https://git.openjdk.org/jdk/pull/14911


More information about the i18n-dev mailing list