On Tue, 27 Oct 2026 22:32:03 GMT, Justin Lu <[email protected]> wrote:

>> This issue originally came in as a performance suggestion to replace the 
>> regex based validation with an ASCII check for `getInstance(Locale)`.
>> 
>> However, the current regex validation does not even appear like it is 
>> required at all, since `getMainTableEntry` already returns 
>> `INVALID_COUNTRY_ENTRY` for invalid characters, correctly leading to `IAE`. 
>> Additionally, the `null` check looks incorrect because 
>> `BaseLocale.getCountry()` is specified to return the empty String, not 
>> `null`. `getCountry()` also returns the country code in uppercase.
>> 
>> All we need to do is check the length to ensure that a country exists and 
>> that it is in the form of a ISO 3166 2-letter code instead of a UN M.49 3 
>> digit code.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Justin Lu has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   preserve exception msg - move format validation out

Looks good. Thanks for the changes, Justin

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

Marked as reviewed by naoto (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/33594#pullrequestreview-5675445207

Reply via email to