From 15df2e7a7547e12e884b624d9f17ad2799d9ccf9 Mon Sep 17 00:00:00 2001 From: Yiqun Lin Date: Mon, 5 Nov 2018 17:31:06 +0800 Subject: [PATCH] HDDS-796. Fix failed test TestStorageContainerManagerHttpServer#testHttpPolicy. --- .../java/org/apache/hadoop/hdds/server/BaseHttpServer.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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));