8077377: java/net/MulticastSocket/SetOutgoingIf.java fails intermittently with NullPointerException
authormsheppar
Wed, 27 May 2015 13:23:40 +0100
changeset 30810 cbb29036f026
parent 30809 2c40760f65a9
child 30811 58432ddf9528
8077377: java/net/MulticastSocket/SetOutgoingIf.java fails intermittently with NullPointerException Summary: ignore "stray" packets received from non test interface Reviewed-by: alanb, chegar
jdk/test/java/net/MulticastSocket/SetOutgoingIf.java
--- a/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java	Wed May 27 13:04:32 2015 +0100
+++ b/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java	Wed May 27 13:23:40 2015 +0100
@@ -156,12 +156,13 @@
                 // now check which network interface this packet comes from
                 NetworkInterface from = NetworkInterface.getByInetAddress(packet.getAddress());
                 NetworkInterface shouldbe = nic;
-                if (!from.equals(shouldbe)) {
-                    System.out.println("Packets on group "
+                if (from != null) {
+                    if (!from.equals(shouldbe)) {
+                        System.out.println("Packets on group "
                                         + group + " should come from "
                                         + shouldbe.getName() + ", but came from "
                                         + from.getName());
-                    //throw new RuntimeException("Test failed.");
+                    }
                 }
 
                 mcastsock.leaveGroup(new InetSocketAddress(group, PORT), nic);