From 11db46956c6062a986caf9009d3e36049e5830d4 Mon Sep 17 00:00:00 2001 From: Xiaoyu Yao Date: Sat, 9 Mar 2019 09:38:01 -0800 Subject: [PATCH] HDDS-1235. BaseHttpServer NPE is HTTP policy is HTTPS_ONLY. Contributed by Xiaoyu Yao. Closes #572 --- .../org/apache/hadoop/hdds/server/BaseHttpServer.java | 10 +++------- 1 file changed, 3 insertions(+), 7 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 4cc9b52b59..9a1d4b3c77 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 @@ -65,14 +65,10 @@ public abstract class BaseHttpServer { public BaseHttpServer(Configuration conf, String name) throws IOException { this.name = name; this.conf = conf; + policy = DFSUtil.getHttpPolicy(conf); if (isEnabled()) { - policy = DFSUtil.getHttpPolicy(conf); - if (policy.isHttpEnabled()) { - this.httpAddress = getHttpBindAddress(); - } - if (policy.isHttpsEnabled()) { - this.httpsAddress = getHttpsBindAddress(); - } + this.httpAddress = getHttpBindAddress(); + this.httpsAddress = getHttpsBindAddress(); HttpServer2.Builder builder = null; builder = DFSUtil.httpServerTemplateForNNAndJN(conf, this.httpAddress, this.httpsAddress, name, getSpnegoPrincipal(), getKeytabFile());