Explorar o código

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
Tsz-wo Sze %!s(int64=11) %!d(string=hai) anos
pai
achega
f23be52c30

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -99,6 +99,9 @@ Release 2.4.1 - UNRELEASED
     HDFS-6198. DataNode rolling upgrade does not correctly identify current
     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 
 
   INCOMPATIBLE CHANGES

+ 3 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java

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