Merge "Use InetAddress.parseNumericAddress."

This commit is contained in:
Elliott Hughes
2011-02-15 17:42:55 -08:00
committed by Android (Google) Code Review

View File

@@ -159,17 +159,7 @@ public class NetworkUtils {
*/
public static InetAddress numericToInetAddress(String addrString)
throws IllegalArgumentException {
// TODO - do this for real, using a hidden method on InetAddress that aborts
// instead of doing dns step
if (!InetAddress.isNumeric(addrString)) {
throw new IllegalArgumentException("numericToInetAddress with non numeric: '" +
addrString + "'");
}
try {
return InetAddress.getByName(addrString);
} catch (UnknownHostException e) {
throw new IllegalArgumentException(e);
}
return InetAddress.parseNumericAddress(addrString);
}
/**