RFR: 8371091: Improve the exception message of NullPointerException thrown by the methods in the default implementation of HttpRequest.Builder [v2]
EunHyunsu
duke at openjdk.org
Mon Nov 3 12:27:17 UTC 2025
On Mon, 3 Nov 2025 12:05:31 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> EunHyunsu has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8271091: Add NPE messages for method
>
> src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestBuilderImpl.java line 226:
>
>> 224: @Override
>> 225: public HttpRequest.Builder method(String method, BodyPublisher body) {
>> 226: requireNonNull(method);
>
> It seems strange to improve the message for `body` but not for `method`.
I agree for consistency.
I'll update the `requireNonNull(method)` call to include an explicit message as well, e.g.,
`requireNonNull(method, "HTTP method must be non-null")`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28103#discussion_r2486295432
More information about the net-dev
mailing list