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

Justin Lu jlu at openjdk.org
Wed Feb 5 23:02:19 UTC 2025


On Wed, 5 Feb 2025 22:51:45 GMT, Naoto Sato <naoto 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.
>
> 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.

Yes, I didn't think it was needed to do that, the existing message should already have enough details. I filed the CSR just in case, I'll withdraw it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23474#discussion_r1943790683


More information about the i18n-dev mailing list