On Thu, 9 Oct 2025 18:12:58 GMT, Justin Lu <[email protected]> wrote:
> Please review this PR which corrects the behavior of
> `Locale.Builder.setLanguageTag(String)` on the null and empty String case.
>
> This method is specified as follows,
>
>> Null and the empty string cause the builder to be reset
>
> Currently, NPE is thrown for a null tag, and ILE is thrown for an empty
> String. They are both corrected to not throw, and instead reset the state of
> the `Locale.Builder`.
LGTM
test/jdk/java/util/Locale/LocaleEnhanceTest.java line 779:
> 777: bldr.setLanguageTag("en-US");
> 778: assertDoesNotThrow(() -> bldr.setLanguageTag(tag));
> 779: assertEquals(tag + " did not clear the builder", empty.build(),
> bldr.build());
Should not happen, but if empty string caused an assertion failure, the error
message starts with " did not clear..."
-------------
Marked as reviewed by naoto (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/27734#pullrequestreview-3320916918
PR Review Comment: https://git.openjdk.org/jdk/pull/27734#discussion_r2418168857