RFR: 8366517: `DateFormatSymbols(Locale)` throws NPE if `Locale` argument is null [v2]
Naoto Sato
naoto at openjdk.org
Wed Sep 3 15:24:46 UTC 2025
On Wed, 3 Sep 2025 00:57:39 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Use Objects.requireNonNull()
>
> src/java.base/share/classes/java/text/DateFormatSymbols.java line 148:
>
>> 146: * if the resources for the specified locale cannot be
>> 147: * found or cannot be loaded.
>> 148: * @throws NullPointerException if {@code locale} is null
>
> Adding an explicit Objects.requireNull(locale, "locale") would clearly identify when the NPE is thrown.
> Though it might be earlier than without the check.
Right. Added the explicit null check. (and a test case)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27060#discussion_r2319328408
More information about the core-libs-dev
mailing list