Merge "[Mainline Migration] Migrate NetworkUtils" am: a086c295e7 am: c6218f7977
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1498168 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I4f91f6de3af919fff42383ba86617112624c8292
This commit is contained in:
@@ -35,7 +35,6 @@ import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@@ -341,20 +340,6 @@ public class NetworkUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a string array of host addresses from a collection of InetAddresses
|
||||
* @param addrs a Collection of InetAddresses
|
||||
* @return an array of Strings containing their host addresses
|
||||
*/
|
||||
public static String[] makeStrings(Collection<InetAddress> addrs) {
|
||||
String[] result = new String[addrs.size()];
|
||||
int i = 0;
|
||||
for (InetAddress addr : addrs) {
|
||||
result[i++] = addr.getHostAddress();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim leading zeros from IPv4 address strings
|
||||
* Our base libraries will interpret that as octel..
|
||||
|
||||
@@ -205,7 +205,7 @@ public final class Proxy {
|
||||
if (host.equalsIgnoreCase("localhost")) {
|
||||
return true;
|
||||
}
|
||||
if (NetworkUtils.numericToInetAddress(host).isLoopbackAddress()) {
|
||||
if (InetAddresses.parseNumericAddress(host).isLoopbackAddress()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user