HDFS-6206. Fix NullPointerException in DFSUtil.substituteForWildcardAddress.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1586034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2014-04-09 16:55:03 +00:00
parent f13a0fd2ad
commit 06e4c84b7d
2 changed files with 6 additions and 1 deletions

View File

@ -347,6 +347,9 @@ Release 2.4.1 - UNRELEASED
HDFS-6198. DataNode rolling upgrade does not correctly identify current HDFS-6198. DataNode rolling upgrade does not correctly identify current
block pool directory and replace with trash on Windows. (cnauroth) block pool directory and replace with trash on Windows. (cnauroth)
HDFS-6206. Fix NullPointerException in DFSUtil.substituteForWildcardAddress.
(szetszwo)
Release 2.4.0 - 2014-04-07 Release 2.4.0 - 2014-04-07
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -37,6 +37,7 @@ import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMESERVICE_ID;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
@ -1100,7 +1101,8 @@ public class DFSUtil {
InetSocketAddress sockAddr = NetUtils.createSocketAddr(configuredAddress); InetSocketAddress sockAddr = NetUtils.createSocketAddr(configuredAddress);
InetSocketAddress defaultSockAddr = NetUtils.createSocketAddr(defaultHost InetSocketAddress defaultSockAddr = NetUtils.createSocketAddr(defaultHost
+ ":0"); + ":0");
if (sockAddr.getAddress().isAnyLocalAddress()) { final InetAddress addr = sockAddr.getAddress();
if (addr != null && addr.isAnyLocalAddress()) {
if (UserGroupInformation.isSecurityEnabled() && if (UserGroupInformation.isSecurityEnabled() &&
defaultSockAddr.getAddress().isAnyLocalAddress()) { defaultSockAddr.getAddress().isAnyLocalAddress()) {
throw new IOException("Cannot use a wildcard address with security. " + throw new IOException("Cannot use a wildcard address with security. " +