--- a/src/java.base/share/classes/java/net/Socket.java Sat Mar 23 15:11:51 2019 +0000
+++ b/src/java.base/share/classes/java/net/Socket.java Sat Mar 30 09:30:03 2019 +0000
@@ -581,7 +581,8 @@
* if this socket has an associated channel,
* and the channel is in non-blocking mode
* @throws IllegalArgumentException if endpoint is null or is a
- * SocketAddress subclass not supported by this socket
+ * SocketAddress subclass not supported by this socket, or
+ * if {@code timeout} is negative
* @since 1.4
* @spec JSR-51
*/
@@ -1212,8 +1213,9 @@
* A timeout of zero is interpreted as an infinite timeout.
*
* @param timeout the specified timeout, in milliseconds.
- * @exception SocketException if there is an error
- * in the underlying protocol, such as a TCP error.
+ * @throws SocketException if there is an error in the underlying protocol,
+ * such as a TCP error
+ * @throws IllegalArgumentException if {@code timeout} is negative
* @since 1.1
* @see #getSoTimeout()
*/
@@ -1221,7 +1223,7 @@
if (isClosed())
throw new SocketException("Socket is closed");
if (timeout < 0)
- throw new IllegalArgumentException("timeout < 0");
+ throw new IllegalArgumentException("timeout can't be negative");
getImpl().setOption(SocketOptions.SO_TIMEOUT, timeout);
}