On Thu, 30 Apr 2026 20:31:10 GMT, Naoto Sato <[email protected]> wrote:
>> Fixing the race condition during the initialization of the skeleton map. The >> root cause was that the map could be accessed while it was still being >> initialized, leading to an NPE. Although the NPE could be avoided by >> returning a default value, the map initialization itself should be made >> thread safe. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Naoto Sato has updated the pull request incrementally with one additional > commit since the last revision: > > Removed unnecessary throws src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java line 660: > 658: var inputSkeletons = new HashMap<String, Map<String, String>>(); > 659: Pattern p = Pattern.compile("([^:]+):([^;]+);"); > 660: if > (LocaleProviderAdapter.forType(LocaleProviderAdapter.Type.CLDR) instanceof > ResourceBundleBasedAdapter rbba) { Since the new code relies on matching the results of `LocaleProviderAdapter.forType(LocaleProviderAdapter.Type.CLDR)`, I think there should be a reasonable `InternalError` or the sorts in an `else` block (or perhaps write it as an inverted `if`). Writing it this way makes it clear to the reader that returning an empty map is not a possible intentional path and also ensures an empty map isn't silently returned by the method in the case of an error (even if unlikely). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31006#discussion_r3174202978
