HDDS-1235. BaseHttpServer NPE is HTTP policy is HTTPS_ONLY. Contributed by Xiaoyu Yao.

Closes #572
This commit is contained in:
Xiaoyu Yao 2019-03-09 09:38:01 -08:00 committed by GitHub
parent 8458ced11e
commit 11db46956c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -65,14 +65,10 @@ public abstract class BaseHttpServer {
public BaseHttpServer(Configuration conf, String name) throws IOException { public BaseHttpServer(Configuration conf, String name) throws IOException {
this.name = name; this.name = name;
this.conf = conf; this.conf = conf;
policy = DFSUtil.getHttpPolicy(conf);
if (isEnabled()) { if (isEnabled()) {
policy = DFSUtil.getHttpPolicy(conf); this.httpAddress = getHttpBindAddress();
if (policy.isHttpEnabled()) { this.httpsAddress = getHttpsBindAddress();
this.httpAddress = getHttpBindAddress();
}
if (policy.isHttpsEnabled()) {
this.httpsAddress = getHttpsBindAddress();
}
HttpServer2.Builder builder = null; HttpServer2.Builder builder = null;
builder = DFSUtil.httpServerTemplateForNNAndJN(conf, this.httpAddress, builder = DFSUtil.httpServerTemplateForNNAndJN(conf, this.httpAddress,
this.httpsAddress, name, getSpnegoPrincipal(), getKeytabFile()); this.httpsAddress, name, getSpnegoPrincipal(), getKeytabFile());