-
Type:
Enhancement
-
Resolution: Unresolved
-
Priority:
P4
-
Affects Version/s: None
-
Component/s: core-libs
Some methods on java.net.http.HttpRequest.Builder, like the POST(), PUT() and method() accept a BodyPublisher. These methods throw a NullPointerException when the given BodyPublisher is null. The default implementation of the HttpRequest.Builder in the JDK throws a NullPointerException of the form:
Exception in thread "main" java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:220)
at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.POST(HttpRequestBuilderImpl.java:180)
It would be good to include what is null in the exception message of that NullPointerException.
This was brought up in the net-dev mailing list discussion https://mail.openjdk.org/pipermail/net-dev/2025-November/028733.html
Exception in thread "main" java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:220)
at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.POST(HttpRequestBuilderImpl.java:180)
It would be good to include what is null in the exception message of that NullPointerException.
This was brought up in the net-dev mailing list discussion https://mail.openjdk.org/pipermail/net-dev/2025-November/028733.html
- links to
-
Review(master)
openjdk/jdk/28103