Author: cnauroth Date: Wed Feb 26 00:33:20 2014 New Revision: 1571883 URL: http://svn.apache.org/r1571883 Log: HDFS-6008. Merging change r1571881 from trunk to branch-2.
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/common/TestJspHelper.java Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1571883&r1=1571882&r2=1571883&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Wed Feb 26 00:33:20 2014 @@ -292,6 +292,9 @@ Release 2.4.0 - UNRELEASED HDFS-5922. DN heartbeat thread can get stuck in tight loop. (Arpit Agarwal) + HDFS-6008. Namenode dead node link is giving HTTP error 500. + (Benoy Antony via cnauroth) + Release 2.3.1 - UNRELEASED INCOMPATIBLE CHANGES Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java?rev=1571883&r1=1571882&r2=1571883&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/JspHelper.java Wed Feb 26 00:33:20 2014 @@ -147,7 +147,9 @@ public class JspHelper { */ public static final class Url { public static String authority(String scheme, DatanodeID d) { - String fqdn = canonicalize(d.getIpAddr()); + String fqdn = (d.getIpAddr() != null && !d.getIpAddr().isEmpty())? + canonicalize(d.getIpAddr()): + d.getHostName(); if (scheme.equals("http")) { return fqdn + ":" + d.getInfoPort(); } else if (scheme.equals("https")) { Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/common/TestJspHelper.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/common/TestJspHelper.java?rev=1571883&r1=1571882&r2=1571883&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/common/TestJspHelper.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/common/TestJspHelper.java Wed Feb 26 00:33:20 2014 @@ -20,6 +20,7 @@ package org.apache.hadoop.hdfs.server.co import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import static org.mockito.Mockito.*; @@ -611,5 +612,20 @@ public class TestJspHelper { assertTrue(upgradeStatusReport.getStatusText(true).equals( MessageFormat.format(EXPECTED_NOTF_PATTERN, version))); } + + @Test + public void testAuthority(){ + DatanodeID dnWithIp = new DatanodeID("127.0.0.1", "hostName", null, + 50020, 50075, 50076, 50010); + assertNotNull(JspHelper.Url.authority("http", dnWithIp)); + + DatanodeID dnWithNullIp = new DatanodeID(null, "hostName", null, + 50020, 50075, 50076, 50010); + assertNotNull(JspHelper.Url.authority("http", dnWithNullIp)); + + DatanodeID dnWithEmptyIp = new DatanodeID("", "hostName", null, + 50020, 50075, 50076, 50010); + assertNotNull(JspHelper.Url.authority("http", dnWithEmptyIp)); + } }