From c9df2ba9376d106dec9ac819f93dafffc7adb785 Mon Sep 17 00:00:00 2001 From: jfrijters Date: Fri, 31 Aug 2012 11:24:27 +0000 Subject: Merged OpenJDK 7u6. --- openjdk/sun/nio/ch/DatagramChannelImpl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'openjdk/sun') diff --git a/openjdk/sun/nio/ch/DatagramChannelImpl.java b/openjdk/sun/nio/ch/DatagramChannelImpl.java index a987bbc4..b2631530 100644 --- a/openjdk/sun/nio/ch/DatagramChannelImpl.java +++ b/openjdk/sun/nio/ch/DatagramChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -657,7 +657,12 @@ class DatagramChannelImpl 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); @@ -966,7 +971,8 @@ class DatagramChannelImpl protected void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + if (state != ST_KILLED) + nd.preClose(fd); ResourceManager.afterUdpClose(); // if member of mulitcast group then invalidate all keys -- cgit v1.2.3