Synced InetAddress test source from Android's latest.
Change on 2018/12/10 by tball
@@ -20,7 +20,6 @@ import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
-import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Collections;
@@ -184,10 +183,8 @@ public class InetAddressTest extends junit.framework.TestCase {
public void test_isReachable_neverThrows() throws Exception {
InetAddress inetAddress = InetAddress.getByName("www.google.com");
- final NetworkInterface netIf;
- try {
- netIf = NetworkInterface.getByName("dummy0");
- } catch (SocketException e) {
+ final NetworkInterface netIf = NetworkInterface.getByName("dummy0");
+ if (netIf == null) {
System.logI("Skipping test_isReachable_neverThrows because dummy0 isn't available");
return;
}
