Hi,

Could someone please review my fix for JDK-8243507 'DatagramSocket constructors don’t always specify what happens when passed invalid parameters'?

Currently, the DatagramSocket constructor `DatagramSocket(SocketAddress bindaddr)` doesn't specify what happens if passed a SocketAddress subclass not supported by this socket. Also, there are two DatagramSocket constructors that accept a port number, but neither constructor specifies what happens when passed port 0, or a port which falls outside of the valid range of port numbers i.e between 0 and 65535 inclusive.

This fix updates the spec for each these constructors to inform the user of what happens when passed an invalid argument. For the constructors that take a port, the spec will now specify that an IllegalArgumentException is thrown when passed a port outside of the acceptable range, or, if zero is passed, that the system will choose an appropriate port for them. For the constructor that takes a SocketAddress, an IllegalArgumentException will be thrown if an invalid SocketAddress subclass is passed as a parameter.

bug: https://bugs.openjdk.java.net/browse/JDK-8243507
csr: https://bugs.openjdk.java.net/browse/JDK-8243976
webrev: http://cr.openjdk.java.net/~pconcannon/8243507/webrevs/webrev.00/


Kind regards,

Patrick

Reply via email to