> 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 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/33594/files - new: https://git.openjdk.org/jdk/pull/33594/files/da1669fc..5f7de6e7 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=33594&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33594&range=00-01 Stats: 22 lines in 1 file changed: 14 ins; 7 del; 1 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
