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:42:40 UTC 2025


On Mon, 3 Nov 2025 12:31:45 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Hello @ehs208, instead of a new test class, could you see if the existing tests in `test/jdk/java/net/httpclient/HttpRequestBuilderTest.java` can be updated for additionally checking the `NullPointerException` message wherever applicable?

Thanks for the suggestion! That makes sense — instead of keeping a separate test class,
I can move these checks into `HttpRequestBuilderTest.java`.

However, since the existing `testNull()` method focuses only on verifying that NPEs are thrown
(regardless of message content), would it make sense to add a small new test method,
say `testNullMessages()`, in the same class to verify the exception messages specifically?

That way we keep the tests co-located but with a clear separation of intent.

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

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


More information about the net-dev mailing list