Created
March 23, 2012 05:14
-
-
Save cantremember/2167130 to your computer and use it in GitHub Desktop.
trivial InetAddress.getByName() in Java
This file contains hidden or 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
try { | |
if (getLog().isTraceEnabled()) | |
getLog().trace("lookup : " + hostname); | |
// oh, lookup! | |
InetAddress ipAddress = InetAddress.getByName(hostname); | |
// NOTE: this is where it went bad on the AWS image | |
// *sigh* | |
return ipAddress.getHostAddress(); | |
} | |
catch (UnknownHostException e) { } | |
catch (Exception e) { | |
getLog().warn("failed to lookup " + hostname, e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment