diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java index 9fea535ec0..2313119bfe 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java @@ -586,12 +586,14 @@ public InetAddress getByName(String host) throws UnknownHostException { * hadoop.security.token.service.use_ip=false */ protected static class QualifiedHostResolver implements HostResolver { - private List searchDomains; + private List searchDomains = new ArrayList<>(); { ResolverConfig resolverConfig = ResolverConfig.getCurrentConfig(); - searchDomains = new ArrayList<>(); - for (Name name : resolverConfig.searchPath()) { - searchDomains.add(name.toString()); + Name[] names = resolverConfig.searchPath(); + if (names != null) { + for (Name name : names) { + searchDomains.add(name.toString()); + } } }