Skip to content
Permalink
Browse files
8240921: Minor correction to HttpResponse.BodySubscribers example
The fix updates the incorrect example of the usage of the class java.net.http.HttpResponse.BodySubscribers.

Reviewed-by: chegar, dfuchs, jboes, pconcannon
  • Loading branch information
Rahul Yadav authored and pconcannon committed Mar 20, 2020
1 parent 37b7a23 commit c5a749080939041210bb77c35a13cc1904db099c
Showing with 6 additions and 6 deletions.
  1. +3 −3 src/java.net.http/share/classes/java/net/http/HttpResponse.java
  2. +3 −3 test/jdk/java/net/httpclient/examples/JavadocExamples.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -891,8 +891,8 @@ public void applyPushPromise(
* objects:
*
* <pre>{@code // Streams the response body to a File
* HttpResponse<byte[]> response = client
* .send(request, responseInfo -> BodySubscribers.ofByteArray());
* HttpResponse<Path> response = client
* .send(request, responseInfo -> BodySubscribers.ofFile(Paths.get("example.html"));
*
* // Accumulates the response body and returns it as a byte[]
* HttpResponse<byte[]> response = client
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -165,8 +165,8 @@ void fromHttpResponse() throws Exception {

// HttpResponse.BodySubscribers class-level description
// Streams the response body to a File
HttpResponse<byte[]> response5 = client
.send(request, responseInfo -> BodySubscribers.ofByteArray());
HttpResponse<Path> response5 = client
.send(request, responseInfo -> BodySubscribers.ofFile(Paths.get("example.html")));

// Accumulates the response body and returns it as a byte[]
HttpResponse<byte[]> response6 = client

0 comments on commit c5a7490

Please sign in to comment.