http-client-branch: review comment - WebSocket/HttpClient wording http-client-branch
authorprappo
Tue, 05 Jun 2018 15:32:02 +0100
branchhttp-client-branch
changeset 56665 67fb9313d860
parent 56654 b72e5af6fb6b
child 56676 7b616fbd7d5b
child 56678 136fe961f3eb
http-client-branch: review comment - WebSocket/HttpClient wording
src/java.net.http/share/classes/java/net/http/HttpClient.java
src/java.net.http/share/classes/java/net/http/WebSocket.java
src/java.net.http/share/classes/jdk/internal/net/http/websocket/OpeningHandshake.java
src/java.net.http/share/classes/jdk/internal/net/http/websocket/WebSocketImpl.java
--- a/src/java.net.http/share/classes/java/net/http/HttpClient.java	Fri Jun 01 18:10:56 2018 +0100
+++ b/src/java.net.http/share/classes/java/net/http/HttpClient.java	Tue Jun 05 15:32:02 2018 +0100
@@ -451,7 +451,7 @@
      * then the response, containing the  {@code 3XX} response code, is returned,
      * where it can be handled manually.
      *
-     * <p> {@code Redirect} policy is set via the {@linkplain
+     * <p> {@code Redirect} policy is set through the {@linkplain
      * HttpClient.Builder#followRedirects(Redirect) Builder.followRedirects}
      * method.
      *
--- a/src/java.net.http/share/classes/java/net/http/WebSocket.java	Fri Jun 01 18:10:56 2018 +0100
+++ b/src/java.net.http/share/classes/java/net/http/WebSocket.java	Tue Jun 05 15:32:02 2018 +0100
@@ -35,7 +35,7 @@
 /**
  * A WebSocket Client.
  *
- * <p> {@code WebSocket} instances can be created via {@link WebSocket.Builder}.
+ * <p> {@code WebSocket} instances are created through {@link WebSocket.Builder}.
  *
  * <p> WebSocket has an input and an output sides. These sides are independent
  * from each other. A side can either be open or closed. Once closed, the side
@@ -55,8 +55,9 @@
  *
  * <p> A receive method is any of the {@code onText}, {@code onBinary},
  * {@code onPing}, {@code onPong} and {@code onClose} methods of
- * {@code Listener}. A receive method initiates a receive operation and returns
- * a {@code CompletionStage} which completes once the operation has completed.
+ * {@code Listener}. WebSocket initiates a receive operation by invoking a
+ * receive method on the listener. The listener then must return a
+ * {@code CompletionStage} which completes once the operation has completed.
  *
  * <p> A WebSocket maintains an <a id="counter">internal counter</a>.
  * This counter's value is a number of times the WebSocket has yet to invoke a
@@ -105,13 +106,13 @@
     /**
      * A builder of {@linkplain WebSocket WebSocket Clients}.
      *
-     * <p> A builder can be created by invoking the
-     * {@link HttpClient#newWebSocketBuilder HttpClient.newWebSocketBuilder}
-     * method. The intermediate (setter-like) methods change the state of the
-     * builder and return the same builder they have been invoked on. If an
-     * intermediate method is not invoked, an appropriate default value (or
-     * behavior) will be assumed. A {@code Builder} is not safe for use by
-     * multiple threads without external synchronization.
+     * <p> Builders are created by invoking
+     * {@link HttpClient#newWebSocketBuilder HttpClient.newWebSocketBuilder}.
+     * The intermediate (setter-like) methods change the state of the builder
+     * and return the same builder they have been invoked on. If an intermediate
+     * method is not invoked, an appropriate default value (or behavior) will be
+     * assumed. A {@code Builder} is not safe for use by multiple threads
+     * without external synchronization.
      *
      * @since 11
      */
@@ -155,7 +156,7 @@
          * Sets a request for the given subprotocols.
          *
          * <p> After the {@code WebSocket} has been built, the actual
-         * subprotocol can be queried via
+         * subprotocol can be queried through
          * {@link WebSocket#getSubprotocol WebSocket.getSubprotocol()}.
          *
          * <p> Subprotocols are specified in the order of preference. The most
--- a/src/java.net.http/share/classes/jdk/internal/net/http/websocket/OpeningHandshake.java	Fri Jun 01 18:10:56 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/websocket/OpeningHandshake.java	Tue Jun 05 15:32:02 2018 +0100
@@ -127,7 +127,7 @@
         }
         this.subprotocols = createRequestSubprotocols(b.getSubprotocols());
         if (!this.subprotocols.isEmpty()) {
-            String p = this.subprotocols.stream().collect(Collectors.joining(", "));
+            String p = String.join(", ", this.subprotocols);
             requestBuilder.header(HEADER_PROTOCOL, p);
         }
         requestBuilder.header(HEADER_VERSION, VERSION);
--- a/src/java.net.http/share/classes/jdk/internal/net/http/websocket/WebSocketImpl.java	Fri Jun 01 18:10:56 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/websocket/WebSocketImpl.java	Tue Jun 05 15:32:02 2018 +0100
@@ -34,7 +34,6 @@
 import jdk.internal.net.http.websocket.OpeningHandshake.Result;
 
 import java.io.IOException;
-import java.lang.System.Logger.Level;
 import java.lang.ref.Reference;
 import java.net.ProtocolException;
 import java.net.URI;
@@ -88,7 +87,7 @@
         PING,
         PONG,
         CLOSE,
-        ERROR;
+        ERROR
     }
 
     private final AtomicReference<ByteBuffer> lastAutomaticPong = new AtomicReference<>();