hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgho...@apache.org
Subject svn commit: r951555 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
Date Fri, 04 Jun 2010 20:20:21 GMT
Author: jghoman
Date: Fri Jun  4 20:20:21 2010
New Revision: 951555

URL: http://svn.apache.org/viewvc?rev=951555&view=rev
Log:
HDFS-1183.  Remove some duplicate code in NamenodeJspHelper.java. Contributed by Jeff Ames.

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=951555&r1=951554&r2=951555&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Fri Jun  4 20:20:21 2010
@@ -39,6 +39,9 @@ Trunk (unreleased changes)
     HDFS-1185. Remove duplicate now() functions in DataNode, FSNamesysetm.
     (Jeff Ames via jghoman)
 
+    HDFS-1183. Remove some duplicate code in NamenodeJspHelper.java.
+    (Jeff Ames via jghoman)
+
   BUG FIXES
 
     HDFS-1039. Adding test for  JspHelper.getUGI(jnp via boryas)

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java?rev=951555&r1=951554&r2=951555&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
(original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
Fri Jun  4 20:20:21 2010
@@ -376,8 +376,9 @@ class NamenodeJspHelper {
       return ret;
     }
 
-    void generateDecommissioningNodeData(JspWriter out, DatanodeDescriptor d,
+    private void generateNodeDataHeader(JspWriter out, DatanodeDescriptor d,
         String suffix, boolean alive, int nnHttpPort) throws IOException {
+      // from nn_browsedfscontent.jsp:
       String url = "http://" + d.getHostName() + ":" + d.getInfoPort()
           + "/browseDirectory.jsp?namenodeInfoPort=" + nnHttpPort + "&dir="
           + URLEncoder.encode("/", "UTF-8");
@@ -392,6 +393,11 @@ class NamenodeJspHelper {
           + d.getPort() + "\" href=\"" + url + "\">"
           + ((idx > 0) ? name.substring(0, idx) : name) + "</a>"
           + ((alive) ? "" : "\n"));
+    }
+
+    void generateDecommissioningNodeData(JspWriter out, DatanodeDescriptor d,
+        String suffix, boolean alive, int nnHttpPort) throws IOException {
+      generateNodeDataHeader(out, d, suffix, alive, nnHttpPort);
       if (!alive) {
         return;
       }
@@ -427,21 +433,7 @@ class NamenodeJspHelper {
        * interact with datanodes.
        */
 
-      // from nn_browsedfscontent.jsp:
-      String url = "http://" + d.getHostName() + ":" + d.getInfoPort()
-          + "/browseDirectory.jsp?namenodeInfoPort=" + nnHttpPort + "&dir="
-          + URLEncoder.encode("/", "UTF-8");
-
-      String name = d.getHostName() + ":" + d.getPort();
-      if (!name.matches("\\d+\\.\\d+.\\d+\\.\\d+.*"))
-        name = name.replaceAll("\\.[^.:]*", "");
-      int idx = (suffix != null && name.endsWith(suffix)) ? name
-          .indexOf(suffix) : -1;
-
-      out.print(rowTxt() + "<td class=\"name\"><a title=\"" + d.getHost() + ":"
-          + d.getPort() + "\" href=\"" + url + "\">"
-          + ((idx > 0) ? name.substring(0, idx) : name) + "</a>"
-          + ((alive) ? "" : "\n"));
+      generateNodeDataHeader(out, d, suffix, alive, nnHttpPort);
       if (!alive)
         return;
 



Mime
View raw message