<i18n dev> RFR: 8248695: HostLocaleProviderAdapterImpl provides invalid date-only

naoto.sato at oracle.com naoto.sato at oracle.com
Tue Jul 14 02:01:06 UTC 2020

Hi Joe,

Thank you for your review.

On 7/13/20 3:55 PM, Joe Wang wrote:
> Hi Naoto,
> Would it make sense to provide an additional test using the public APIs 
> similar to the one provided in the bug report? I'm sure yours is correct 
> and covers more cases than the original, but it would be nice to have an 
> actual use case and use the public APIs. The report showed it was failed 
> somewhere down the stream than when it is run against the current build, 
> which produces IAE "Too many pattern letters: a" instead of what's 
> reported.

I am not quite sure I got your suggestion, but the test case uses the 
same API as in the bug report (LocaleProviders.java, line 421-428) that 
are supposed to catch two cases, i.e., 
ofLocalizedDate()/ofLocalizedTime() tests catch "unsupported temporal 
field" exception, such as HourOfDay, and ofLocalizedDateTime() catches 
"Too many pattern letters: aa" which you saw in (possibly) en_US locale. 
To make it clearer, I added some comments to it.

> HostLocaleProviderAdapter_md:849 - 865: may be compacted into one if 
> statement, (bCal && getCalendarInfoWrapper(...) || 
> getLocaleInfoWrapper(...)).

Quite right. Modified.

The updated webrev is located at:



> Regards,
> Joe
> On 7/13/2020 5:54 AM, naoto.sato at oracle.com wrote:
>> Ping.
>> On 7/7/20 3:55 PM, naoto.sato at oracle.com wrote:
>>> Hello,
>>> Please review the fix to the following issue:
>>> https://bugs.openjdk.java.net/browse/JDK-8248695
>>> The proposed changeset is located at:
>>> http://cr.openjdk.java.net/~naoto/8248695/webrev.00/
>>> There were two causes that resulted in throwing exceptions. One was 
>>> that the Host adapter for Windows always produced Date and Time 
>>> combined patterns, so formatting a LocalDate ended up with 
>>> unsupported temporal field for HourOfDay (reported in the bug), and 
>>> the other cause was the pattern for am/pm was "aa", which was not 
>>> valid as a DateTimeFormatter pattern.
>>> Besides these issues, localized DayOfWeek/AM_PM names have not been 
>>> correctly implemented in the host adapter. Now those names are 
>>> correctly returned from Windows.
>>> Naoto

More information about the i18n-dev mailing list