<i18n dev> RFR: 8176706: Additional Date-Time Formats

Joe Wang joehw at openjdk.java.net
Tue Feb 8 01:06:07 UTC 2022


On Thu, 3 Feb 2022 23:29:54 GMT, Naoto Sato <naoto at openjdk.org> wrote:

> Following the prior discussion [1], here is the PR for the subject enhancement. CSR has also been updated according to the suggestion.
> 
> [1] https://mail.openjdk.java.net/pipermail/core-libs-dev/2022-January/085175.html

src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java line 254:

> 252:     public static String getLocalizedDateTimePattern(String requestedTemplate,
> 253:                                                      Chronology chrono, Locale locale) {
> 254:         Objects.requireNonNull(locale, "requestedTemplate");

Typo, "locale" should have been requestedTemplate.

src/java.base/share/classes/sun/util/locale/provider/JavaTimeDateTimePatternImpl.java line 77:

> 75:         LocaleProviderAdapter lpa = LocaleProviderAdapter.getResourceBundleBased();
> 76:         // CLDR's 'u'/'U' are not supported in the JDK. Replace them with 'y' instead
> 77:         final var modifiedSkeleton = requestedTemplate.replaceAll("[uU]", "y");

Seems to me requestedTemplate needs to be validated when it gets passed to getLocalizedDateTimePattern,  similar as to appendLocalized

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

PR: https://git.openjdk.java.net/jdk/pull/7340


More information about the i18n-dev mailing list