Program: 78514
Project: 78514
Buggy source:
/** 
 * Sends an empty Close message. <p> When this method has been invoked, no further messages can be sent. <p> For more details on Close message see RFC 6455 section <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1">5.5.1. Close</a> <p> The method returns a   {@code CompletableFuture<WebSocket>} whichcompletes normally when the message has been sent or completes exceptionally if an error occurs. <p> The returned  {@code CompletableFuture} can complete exceptionallywith: <ul> <li>  {@link IOException} -if an I/O error occurs during this operation; or the  {@code WebSocket} has been closed due to an error</ul> <p> If this method has already been invoked or the  {@code WebSocket} isclosed, then subsequent invocations of this method have no effect and the returned  {@code CompletableFuture} completes normally.<p> If a Close message has been  {@linkplain Listener#onClose(WebSocket,int,String) received} before, then this invocation completes the closinghandshake and by the time the returned  {@code CompletableFuture}completes, the   {@code WebSocket} will have been closed.
 * @return a {@code CompletableFuture} with this {@code WebSocket}
 * @see #sendClose(int,String)
 */
CompletableFuture<WebSocket> sendClose();

Fixed version (ground truth):
/** 
 * Sends a Close message with the given status code and the reason. <p> When this method has been invoked, no further messages can be sent. <p> The   {@code statusCode} is an integer in the range {@code 1000 <= code<= 4999}. However, not all status codes may be legal in some implementations. Regardless of an implementation, <code>  {@value jdk.incubator.http.WebSocket#NORMAL_CLOSURE}</code> is always legal and   {@code 1002},   {@code 1003},   {@code 1005},   {@code 1006},   {@code 1007},   {@code 1009},   {@code 1010},   {@code 1012},   {@code 1013} and {@code 1015} are always illegal codes.<p> The  {@code reason} is a short string that must have an UTF-8representation not longer than  {@code 123} bytes. For more details onClose message, status codes and reason see RFC 6455 sections <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1">5.5.1. Close</a> and <a href="https://tools.ietf.org/html/rfc6455#section-7.4">7.4. Status Codes</a>. <p> The method returns a  {@code CompletableFuture<WebSocket>} whichcompletes normally when the message has been sent or completes exceptionally if an error occurs. <p> The returned  {@code CompletableFuture} can complete exceptionallywith: <ul> <li>  {@link IllegalArgumentException} -if the  {@code statusCode} has an illegal value;or if  {@code reason} doesn't have an UTF-8 representation oflength  {@code <= 123}<li>   {@link IOException} -if an I/O error occurs during this operation; or the  {@code WebSocket} has been closed due to an error</ul> <p> If this method has already been invoked or the  {@code WebSocket} isclosed, then subsequent invocations of this method have no effect and the returned  {@code CompletableFuture} completes normally.<p> If a Close message has been  {@linkplain Listener#onClose(WebSocket,int,String) received} before, then this invocation completes the closinghandshake and by the time the returned  {@code CompletableFuture}completes, the   {@code WebSocket} will have been closed.
 * @param statusCode the status code
 * @param reason the reason
 * @return a {@code CompletableFuture} with this {@code WebSocket}
 */
CompletableFuture<WebSocket> sendClose(int statusCode,String reason);