On Tue, 4 Nov 2025 11:37:13 GMT, EunHyunsu <[email protected]> wrote:

>> This change adds clearer NullPointerException messages to the POST(), PUT(), 
>> and method() methods in HttpRequest.Builder when the provided BodyPublisher 
>> is null.
>> 
>> Each of these methods now calls `requireNonNull(body, "BodyPublisher must 
>> not be null")`, making the exception message explicit.
>> A corresponding regression test (RequestBuilderNullBodyTest) has been added 
>> to verify this behavior.
>> 
>> All builds and related tests (jdk/java/net/httpclient) have passed 
>> successfully.
>> 
>> Currently, only POST(), PUT(), and method() include these messages.
>> Some other builder methods (such as header(), setHeader()) also throw 
>> NullPointerException without a message.
>> I would like to discuss whether adding consistent messages to those methods 
>> would be beneficial,
>> and whether the current wording "BodyPublisher must not be null" feels 
>> appropriate.
>
> EunHyunsu has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8371091: Add testNullMessages() to HttpRequestBuilderTest and fix 
> whitespaces error

@ehs208 
Your change (at version f26cc336c878e18757e996b95e983cbaca8a0ce4) is now ready 
to be sponsored by a Committer.

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

PR Comment: https://git.openjdk.org/jdk/pull/28103#issuecomment-3497986860

Reply via email to