Created
October 3, 2011 15:51
-
-
Save Ramasubramanian/1259427 to your computer and use it in GitHub Desktop.
handler hash code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected synchronized InetAddress getHostAddress(URL u) { | |
if (u.hostAddress != null) | |
return u.hostAddress; | |
String host = u.getHost(); | |
if (host == null || host.equals("")) { | |
return null; | |
} else { | |
try { | |
u.hostAddress = InetAddress.getByName(host); | |
} catch (UnknownHostException ex) { | |
return null; | |
} catch (SecurityException se) { | |
return null; | |
} | |
} | |
return u.hostAddress; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment