On Thu, 24 Sep 2026 01:58:17 GMT, moseoh <[email protected]> wrote:

>> `CLDRTimeZoneNameProviderImpl.getDisplayNameArray()` modifies the array
>> cached by `LocaleResources` when filling in missing time zone names.
>> As a result, names derived for a parent locale can be reused by a later
>> lookup for a child locale, making the result depend on lookup order.
>> 
>> This change copies the array before updating the zone ID and deriving
>> fallback names, leaving the cached array unchanged.
>> 
>> `TimeZoneNameOrderTest` compares a direct lookup with a lookup made after
>> querying the parent locale. The two runs use separate JVMs so that they
>> do not share cached state.
>> 
>> `TimeZoneNameConcurrencyTest` compares concurrent first lookups with
>> sequential lookups in a fresh JVM. It is included to cover the race seen
>> in 11u/17u/21u; it passes on mainline both before and after the fix.
>> 
>> Tested with jtreg sun/util, java/util/TimeZone and java/util/Locale on 
>> linux-x64.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> moseoh has updated the pull request incrementally with one additional commit 
> since the last revision:
> 
>   Check names returned by concurrent first lookups

LGTM. Thanks for the changes.

test/jdk/sun/util/locale/provider/TimeZoneNameConcurrencyTest.java line 120:

> 118:         System.out.println(us);
> 119:         System.out.println(en);
> 120:     }

This could be removed as it is only called from a single location, but I am 
fine leaving it as it is

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

Marked as reviewed by naoto (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/32867#pullrequestreview-5309284323
PR Review Comment: https://git.openjdk.org/jdk/pull/32867#discussion_r4097696917

Reply via email to