# HG changeset patch # User chegar # Date 1519050991 0 # Node ID eae2b2d7fe527b4a9e96ced0d898646577702fad # Parent 11e32a62803dc4294244fbb7d8ae2d5f0f24663b http-client-branch: clarify strict size requirement for received ping/pong messages diff -r 11e32a62803d -r eae2b2d7fe52 src/java.net.http/share/classes/java/net/http/WebSocket.java --- a/src/java.net.http/share/classes/java/net/http/WebSocket.java Fri Feb 16 18:18:16 2018 +0000 +++ b/src/java.net.http/share/classes/java/net/http/WebSocket.java Mon Feb 19 14:36:31 2018 +0000 @@ -26,6 +26,7 @@ package java.net.http; import java.io.IOException; +import java.net.ProtocolException; import java.net.URI; import java.nio.ByteBuffer; import java.time.Duration; @@ -213,6 +214,10 @@ * as an argument to {@code Listener}'s methods. A {@code WebSocket} invokes * methods on its listener in a thread-safe manner. * + *

Messages received by the {@code Listener} conform to the WebSocket + * Protocol, otherwise {@code onError} with a {@link ProtocolException} is + * invoked. + * *

Unless otherwise stated if a listener's method throws an exception or * a {@code CompletionStage} returned from a method completes exceptionally, * the {@code WebSocket} will invoke {@code onError} with this exception. @@ -329,8 +334,9 @@ /** * A Ping message has been received. * - *

The message consists of not more than {@code 125} bytes from - * the buffer's position to its limit. + *

As guaranteed by the WebSocket Protocol, the message consists of + * not more than {@code 125} bytes. These bytes are located from the + * buffer's position to its limit. * *

Return a {@code CompletionStage} which will be used by the * {@code WebSocket} as a signal it may reclaim the @@ -362,8 +368,9 @@ /** * A Pong message has been received. * - *

The message consists of not more than {@code 125} bytes from - * the buffer's position to its limit. + *

As guaranteed by the WebSocket Protocol, the message consists of + * not more than {@code 125} bytes. These bytes are located from the + * buffer's position to its limit. * *

Return a {@code CompletionStage} which will be used by the * {@code WebSocket} as a signal it may reclaim the