From 3064b9e18e7c0a1c8eabb3d9933efd49180079da Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 15 Feb 2011 17:11:29 -0800 Subject: [PATCH] Use InetAddress.parseNumericAddress. Bug: 3300307 Change-Id: I4ebfe533056e67931db1117e934596ba7b5c8b75 --- core/java/android/net/NetworkUtils.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java index 97f96daff7..b3f39885f9 100644 --- a/core/java/android/net/NetworkUtils.java +++ b/core/java/android/net/NetworkUtils.java @@ -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); } /**