Hi Alan,
yes, that's about it. The test is just logging that expected interface is not equal to from.
So ignoring the stray packet seems reasonable and overcomes the NPE.
We could  log the fact that a stray packet has been received

                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.");
                    }
                } else {
                    System.out.println("Unexpected packet received from  " + 
packet.getAddress());
                }

I can remove the commented throw

regards
Mark


On 26/05/2015 20:43, Alan Bateman wrote:
On 26/05/2015 20:34, Mark Sheppard wrote:
Hi
   please oblige and review the following change
http://cr.openjdk.java.net/~msheppar/8077377/webrev/

to address the issue
https://bugs.openjdk.java.net/browse/JDK-8077377

it is possible that "stray" packets can be received in this MulticastSocket test, and this results in a NPE from the NetworkInterface lookup based on the received address.
Change adds a test that the "from" NetworkInterface is not null.
If I read this correctly then it just ignores the packet when it comes from a non-local interface (or interference from something else on the network).

Should the commented out throwing on RuntimeException be removed while you are there?

-Alan.

Reply via email to