Hi , I wonder about the coding in SocketPermissionTest.java  
joinGroupMulticastTest() :

https://github.com/openjdk/jdk/blob/master/test/jdk/java/net/SocketPermission/SocketPermissionTest.java#L224

            // Positive ( requires a functional network interface )
            Optional<NetworkInterface> onif = 
probe().ip4MulticastInterfaces().findFirst();
            if (!onif.isPresent()) {
                s.setNetworkInterface(onif.get());

In case of  !onif.isPresent() , we call in the next line  onif get , that leads 
always to a

java.util.NoSuchElementException: No value present
        at java.util.Optional.get(Optional.java:135)
        at 
SocketPermissionTest.joinGroupMulticastTest(SocketPermissionTest.java:221)

Is this really intended ?   Should it  be  if (onif.isPresent()) {..}    ?

Best regards, Matthias

Reply via email to