8077377: java/net/MulticastSocket/SetOutgoingIf.java fails intermittently with NullPointerException

Ignore "stray" packets received from non test interface

Reviewed-by: alanb, chegar
This commit is contained in:
Mark Sheppard 2015-05-27 13:23:40 +01:00
parent 03c24ff25b
commit 48a0b96187

View File

@ -156,12 +156,13 @@ public class SetOutgoingIf {
// 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);