diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/BaseHttpServer.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/BaseHttpServer.java index 2726fc3c51d..5e7d7b8032e 100644 --- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/BaseHttpServer.java +++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/BaseHttpServer.java @@ -115,13 +115,10 @@ public abstract class BaseHttpServer { final Optional addressPort = getPortNumberFromConfigKeys(conf, addressKey); - final Optional addresHost = + final Optional addressHost = getHostNameFromConfigKeys(conf, addressKey); - String hostName = bindHost.orElse(addresHost.get()); - if (hostName == null || hostName.isEmpty()) { - hostName = bindHostDefault; - } + String hostName = bindHost.orElse(addressHost.orElse(bindHostDefault)); return NetUtils.createSocketAddr( hostName + ":" + addressPort.orElse(bindPortdefault));