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). ------------- Commit messages: - init Changes: https://git.openjdk.org/jdk/pull/33594/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=33594&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8395882 Stats: 4 lines in 1 file changed: 0 ins; 2 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/33594.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/33594/head:pull/33594 PR: https://git.openjdk.org/jdk/pull/33594
