mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8237890: DatagramPacket::getSocketAddress doesn't specify what happens if address or port are not set
This fix changes the default port of a DatagramPacket from -1 to 0, which changes the behaviour of calling getSocketAddress with no port set from throwing an IAE to returning an InetSocketAddress representing any local address with port 0. Reviewed-by: alanb, chegar, dfuchs
This commit is contained in:
parent
ac088b4631
commit
8e21a2a1e4
5 changed files with 109 additions and 55 deletions
|
@ -209,7 +209,6 @@ public class DatagramSocketAdaptor
|
|||
p.setPort(remote.getPort());
|
||||
target = remote;
|
||||
} else {
|
||||
// throws IllegalArgumentException if port not set
|
||||
target = (InetSocketAddress) p.getSocketAddress();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue