Skip to content

Commit

Permalink
Failure acquiring local host IP address results in 400 #2243
Browse files Browse the repository at this point in the history
- Specific to some setups where the name lookup fails.

Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
  • Loading branch information
prb112 committed Apr 15, 2021
1 parent b2c6ea0 commit aadbdb8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ private static String determineIP() {
try {
ip = Inet4Address.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
log.log(Level.SEVERE, "Failure acquiring local host IP address", e);
// Defaulting to the localhost, as the machine's name is not registered in the local lookup/dns.
log.log(Level.SEVERE, "Failure acquiring local host IP address - be sure the name is registered in the name resolution service", e);
ip = "127.0.0.1";
} catch (NumberFormatException e) {
log.log(Level.SEVERE, "Failure parsing local host IP address '" + ip + "'", e);
// Defaulting to the localhost, as the machine's name is not registered in the local lookup/dns.
log.log(Level.SEVERE, "Failure parsing local host IP address '" + ip + "' - be sure the name is registered in the name resolution service" , e);
ip = "127.0.0.1";
}
return ip;
}
Expand Down

0 comments on commit aadbdb8

Please sign in to comment.