Use InetAddress.parseNumericAddress. am: 3064b9e18e

Original change: undetermined

Change-Id: Ie50a7ffa4340fe6df5b052ace14c7d366034ab3f
This commit is contained in:
Elliott Hughes
2021-05-31 04:11:36 +00:00
committed by Automerger Merge Worker

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);
}
/**