diff options
author | alanb <none@none> | 2011-08-26 22:24:12 +0100 |
---|---|---|
committer | alanb <none@none> | 2011-08-26 22:24:12 +0100 |
commit | e4622498b6eb668fafa27cda08f875b5f939a746 (patch) | |
tree | 8fe5e0cc49d413ec54d2cb9d9e6aec9deb7fbac4 /test/java/nio/channels | |
parent | 3d593c9b0569331e270a751de13c36f6802bd187 (diff) |
7060243: (dc) Multicasting tests fail on Windows XP if IPv6 is enabled
Reviewed-by: alanb
Contributed-by: kurchi.subhra.hazra@oracle.com
Diffstat (limited to 'test/java/nio/channels')
-rw-r--r-- | test/java/nio/channels/DatagramChannel/NetworkConfiguration.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java b/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java index f22b35037..7833a4b89 100644 --- a/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java +++ b/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java @@ -57,11 +57,22 @@ class NetworkConfiguration { return ip6Interfaces.get(nif); } + // IPv6 not supported for Windows XP/Server 2003 + static boolean isIPv6Supported() { + if (System.getProperty("os.name").startsWith("Windows")) { + String ver = System.getProperty("os.version"); + int major = Integer.parseInt(ver.split("\\.")[0]); + return (major >= 6); + } + return true; + } + static NetworkConfiguration probe() throws IOException { Map<NetworkInterface,List<InetAddress>> ip4Interfaces = new HashMap<NetworkInterface,List<InetAddress>>(); Map<NetworkInterface,List<InetAddress>> ip6Interfaces = new HashMap<NetworkInterface,List<InetAddress>>(); + boolean isIPv6Supported = isIPv6Supported(); // find the interfaces that support IPv4 and IPv6 List<NetworkInterface> nifs = Collections @@ -81,7 +92,7 @@ class NetworkConfiguration { } list.add(addr); ip4Interfaces.put(nif, list); - } else if (addr instanceof Inet6Address) { + } else if (isIPv6Supported && (addr instanceof Inet6Address)) { List<InetAddress> list = ip6Interfaces.get(nif); if (list == null) { list = new LinkedList<InetAddress>(); |