<i18n dev> RFR: 8349493: Replace sun.util.locale.ParseStatus usage with java.text.ParsePosition

Naoto Sato naoto at openjdk.org
Wed Feb 5 22:55:11 UTC 2025


On Wed, 5 Feb 2025 21:25:56 GMT, Justin Lu <jlu at openjdk.org> wrote:

> Please review this PR which removes  _sun.util.locale.ParseStatus_ which is a Locale helper class used for parsing language tags.
> 
> Such usages should be replaced by _java.text.ParsePosition_ which has almost 1 to 1 behavior. Note that this cleanup changes the exception message in `Locale.caseFoldLanguageTag(String)` to no longer be prepended by `"Ill formed tag: "`. As such, a CSR is filed to address the compatibility aspect.

Looks good. Nice cleanup. I don't think changing the exception message requires a CSR though.

src/java.base/share/classes/sun/util/locale/LanguageTag.java line 423:

> 421:             throw new IllformedLocaleException(String.format("Ill formed tag:" +
> 422:                     " %s", sts.errorMsg));
> 423:         }

If we want to keep the existing behavior, catch the ILE and throw a new one with the prepending text, but I think that won't be necessary.

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

PR Review: https://git.openjdk.org/jdk/pull/23474#pullrequestreview-2597166661
PR Review Comment: https://git.openjdk.org/jdk/pull/23474#discussion_r1943783817


More information about the i18n-dev mailing list