lhotari commented on code in PR #4588:
URL: https://github.com/apache/bookkeeper/pull/4588#discussion_r2048486974
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java:
##########
@@ -267,25 +266,16 @@ public static BookieSocketAddress
getBookieAddress(ServerConfiguration conf)
iface = "default";
}
- String hostName = DNS.getDefaultHost(iface);
- InetSocketAddress inetAddr = new InetSocketAddress(hostName,
conf.getBookiePort());
- if (inetAddr.isUnresolved()) {
- throw new UnknownHostException("Unable to resolve default
hostname: "
- + hostName + " for interface: " + iface);
- }
- String hostAddress = null;
- InetAddress iAddress = inetAddr.getAddress();
+ String hostAddress = DNS.getDefaultIP(iface);
if (conf.getUseHostNameAsBookieID()) {
- hostAddress = iAddress.getCanonicalHostName();
+ hostAddress =
InetAddress.getByName(hostAddress).getCanonicalHostName();
Review Comment:
I wonder if it would be useful to catch `UnknownHostException` and throw a
new one in the same way as the original code was doing?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]