Merge "[Mainline Migration] Migrate NetworkUtils"

This commit is contained in:
Serik Beketayev
2020-12-09 23:47:05 +00:00
committed by Gerrit Code Review
13 changed files with 53 additions and 53 deletions

View File

@@ -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..

View File

@@ -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;
}
}