RFR: 8371009: HttpClient javadoc synchronous example missing HttpRequest variable declaration
Daniel Fuchs
dfuchs at openjdk.org
Fri Oct 31 10:58:11 UTC 2025
On Fri, 31 Oct 2025 10:22:06 GMT, EunHyunsu <duke at openjdk.org> wrote:
> Fixes JDK-8371009.
>
> The synchronous HttpClient example references `request` without defining it.
> This patch adds a minimal HttpRequest initialization immediately before the
> synchronous example (mirroring the asynchronous snippet) so the example
> compiles and runs as-is.
src/java.net.http/share/classes/java/net/http/HttpClient.java line 101:
> 99: * .uri(URI.create("https://foo.com/"))
> 100: * .build();
> 101: *
Thanks for working on this patch!
I would put the creation of the request after the creation of the client. Logically you would create the client first.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28084#discussion_r2481023063
More information about the net-dev
mailing list