8077377: java/net/MulticastSocket/SetOutgoingIf.java fails intermittently with NullPointerException
Summary: ignore "stray" packets received from non test interface
Reviewed-by: alanb, chegar
--- 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);