RFR [13] 8219446: Specify behaviour of timeout accepting methods of Socket and ServerSocket if timeout is negative

Daniel Fuchs daniel.fuchs at oracle.com
Fri Mar 22 12:14:22 UTC 2019


Hi Chris,

Looks like the right thing to do.

+1

-- daniel

On 22/03/2019 11:44, Chris Hegarty wrote:
> This review request is for a specification only change. It clarifies the
> behaviour of the timeout accepting methods of Socket and ServerSocket,
> when the given a negative timeout. A negative timeout value will result
> in an IllegalArgumentException being thrown.
> 
> These methods already throw IllegalArgumentException, so this change is
> effectively documenting existing long-standing behaviour.
> 
> Note: Before this change, ServerSocket::setSoTimeout defers the timeout
> argument checking to its socket impl. The default plain socket impl
> throws IllegalArgumentException if given a negative timeout. It is
> possible, but unlikely, that an alternative custom socket impl could
> have accepted a negative timeout, but the effects of such are
> unspecified and unknown. After this change, ServerSocket will no longer
> defer the timeout argument checking, it will check its own arguments.
> 
> Webrev:
>    http://cr.openjdk.java.net/~chegar/8219446/webrev.00/
> CSR:
>    https://bugs.openjdk.java.net/browse/JDK-8221248
> 
> -Chris.



More information about the net-dev mailing list