RFR 8224477 [13] java.net.Socket::setOption - implementation mismatch to spec

Chris Hegarty chris.hegarty at oracle.com
Tue May 21 18:36:15 UTC 2019


The get/setOption methods of java.net Socket, ServerSocket, and
DatagramSocket, are specified to throw NullPointerException if the given
option name is null ( rather than UnsupportedOperationException, which
is currently thrown ). The implementation correctly did this in JDK 9 (
on *nix platforms at least ), when the methods were added, but has since
regressed.

The fix is straight forward; explicitly check the given option name
using Objects::requireNonNull, and update an existing regression test to
ensure that this behaviour does not unwittingly regress.

Webrev:
  https://cr.openjdk.java.net/~chegar/8224477/webrev.00/

-Chris.



More information about the net-dev mailing list