HADOOP-15764. Addendum patch: Fix NPE in SecurityUtil.

This commit is contained in:
Akira Ajisaka 2018-09-28 10:02:56 +09:00
parent 2a5d4315bf
commit 5c8d90763c
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
1 changed files with 6 additions and 4 deletions

View File

@ -586,12 +586,14 @@ public final class SecurityUtil {
* hadoop.security.token.service.use_ip=false
*/
protected static class QualifiedHostResolver implements HostResolver {
private List<String> searchDomains;
private List<String> 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());
}
}
}