RFR [13] 8219446: Specify behaviour of timeout accepting methods of Socket and ServerSocket if timeout is negative
Alan Bateman
Alan.Bateman at oracle.com
Fri Mar 22 11:54:24 UTC 2019
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
This looks okay to me, I've added myself as Reviewer on the CSR.
One small suggestion for the exception message is use "timeout < 0" to
avoid needing to use "can't" in the message.
-Alan
More information about the net-dev
mailing list