RFR[7021373]: DatagramPacket exception conditions are not clear

Alan Bateman Alan.Bateman at oracle.com
Fri Jan 24 11:41:42 UTC 2020


On 24/01/2020 11:14, Patrick Concannon wrote:
> Hi,
>
> Could someone please review my fix and CSR for issue JDK-7021373 
> 'DatagramPacket exception conditions are not clear' ?
>
> This fix updates the spec concerning the exceptions thrown by the 
> constructors of the DatagramPacket class, and several methods therein.
>
>
> bug: https://bugs.openjdk.java.net/browse/JDK-7021373
>
> CSR: https://bugs.openjdk.java.net/browse/JDK-8237774
> webrev: http://cr.openjdk.java.net/~pconcannon/7021373/webrevs/webrev.00/
I just skimmed over this (not a complete review) but getSocketAddress() 
throwing IllegalArgumentException doesn't strange as the method doesn't 
take any parameters. I assume this is oversight from when this method 
was added in JDK 1.4. I'm just wondering about the compatibility impact 
of fixing it to IllegalStateException. An exception here would suggest 
user error as the datagram packet is only partially setup so the 
compatibility impact of fixing it is probably low. I'm not saying we do 
this, just wondering if anything might rely on this (the DatagramSocket 
socket adaptor case is an outlier).

-Alan.


More information about the net-dev mailing list