svn merge -c 1586034 from trunk for HDFS-6206. Fix NullPointerException in DFSUtil.substituteForWildcardAddress.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1586037 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2014-04-09 16:55:48 +00:00
parent 29f9ee01ce
commit f23be52c30
2 changed files with 6 additions and 1 deletions

View File

@ -99,6 +99,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;
@ -1101,7 +1102,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. " +