<i18n dev> RFR: 8041488: Locale-Dependent List Patterns [v15]

Roger Riggs rriggs at openjdk.org
Fri Sep 8 14:46:54 UTC 2023


On Thu, 7 Sep 2023 18:20:28 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Introducing a new formatting class for locale-dependent list patterns. The class is to provide the functionality from the Unicode Consortium's LDML specification for [list patterns](https://www.unicode.org/reports/tr35/tr35-general.html#ListPatterns). For example, given a list of String as "Monday", "Wednesday", "Friday", its `format` method would produce "Monday, Wednesday, and Friday" in US English. A CSR has also been drafted, and its draft javadoc can be viewed here: https://cr.openjdk.org/~naoto/JDK-8041488-ListPatterns-PR/api.00/java.base/java/text/ListFormat.html
>
> Naoto Sato has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 24 additional commits since the last revision:
> 
>  - Reflects review comments
>  - Merge branch 'master' into JDK-8041488-ListPatterns-PR
>  - Incorporating suggested changes
>  - Update src/java.base/share/classes/java/text/ListFormat.java
>    
>    Co-authored-by: Roger Riggs <Roger.Riggs at Oracle.com>
>  - Update src/java.base/share/classes/java/text/ListFormat.java
>    
>    Co-authored-by: Roger Riggs <Roger.Riggs at Oracle.com>
>  - Update src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java
>    
>    Co-authored-by: Roger Riggs <Roger.Riggs at Oracle.com>
>  - Removing unnecessary commas
>  - Added tests
>  - Review comments
>  - Merge branch 'master' into JDK-8041488-ListPatterns-PR
>  - ... and 14 more: https://git.openjdk.org/jdk/compare/5793a5da...bce82a4f

src/java.base/share/classes/java/text/ListFormat.java line 536:

> 534:         try {
> 535:             init();
> 536:         } catch (IllegalArgumentException iae) {

If the `patterns` array contains a null, perhaps due to corrupted stream contents, `init()` will throw NPE.
I don't recommend catching NPE here, but perhaps `init()` should check for nulls and throw IAE.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15130#discussion_r1319965477


More information about the i18n-dev mailing list