Skip to content

Commit

Permalink
Better Exception in NetworkUtilsTests (#42109)
Browse files Browse the repository at this point in the history
* We are still running into an exception here every so often
   * Adjusted exception to contain interface name 
* Relates to #41549
  • Loading branch information
original-brownbear authored Jun 10, 2019
1 parent 4586f29 commit ad2e9fa
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;

import static org.hamcrest.Matchers.containsString;
Expand Down Expand Up @@ -88,8 +89,12 @@ public void testFilter() throws Exception {
*/
public void testAddressInterfaceLookup() throws Exception {
for (NetworkInterface netIf : NetworkUtils.getInterfaces()) {
if (!netIf.isUp() || Collections.list(netIf.getInetAddresses()).isEmpty()) {
continue;
try {
if (!netIf.isUp() || Collections.list(netIf.getInetAddresses()).isEmpty()) {
continue;
}
} catch (SocketException e) {
throw new AssertionError("Failed to check if interface [" + netIf + "] is up", e);
}

String name = netIf.getName();
Expand Down

0 comments on commit ad2e9fa

Please sign in to comment.