--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java Fri Jun 08 05:39:14 2012 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java Fri Jun 08 18:23:28 2012 +0100
@@ -661,7 +661,12 @@
throw new AlreadyBoundException();
InetSocketAddress isa;
if (local == null) {
- isa = new InetSocketAddress(0);
+ // only Inet4Address allowed with IPv4 socket
+ if (family == StandardProtocolFamily.INET) {
+ isa = new InetSocketAddress(InetAddress.getByName("0.0.0.0"), 0);
+ } else {
+ isa = new InetSocketAddress(0);
+ }
} else {
isa = Net.checkAddress(local);