hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077330 - in /hadoop/common/branches/branch-0.20-security-patches/src: hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java webapps/datanode/browseDirectory.jsp
Date Fri, 04 Mar 2011 04:04:08 GMT
Author: omalley
Date: Fri Mar  4 04:04:08 2011
New Revision: 1077330

URL: http://svn.apache.org/viewvc?rev=1077330&view=rev
Log:
commit 4087540aecc2b36c7515e0b51158bdfc59082c04
Author: Hairong Kuang <hairong@ucdev21.inktomisearch.com>
Date:   Wed Mar 17 20:56:13 2010 +0000

    HDFS:985 from https://issues.apache.org/jira/secure/attachment/12439066/directoryBrowse_0.20yahoo_2.patch.

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java
    hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java?rev=1077330&r1=1077329&r2=1077330&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java
Fri Mar  4 04:04:08 2011
@@ -300,7 +300,7 @@ public class DistributedFileSystem exten
       thisListing = dfs.listPaths(src, thisListing.getLastName());
       
       if (thisListing == null) {
-        break; // the directory is deleted
+        return null; // the directory is deleted
       }
       
       partialListing = thisListing.getPartialListing();

Modified: hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp?rev=1077330&r1=1077329&r2=1077330&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/webapps/datanode/browseDirectory.jsp
Fri Mar  4 04:04:08 2011
@@ -103,16 +103,8 @@
                   JspHelper.SET_DELEGATION + tokenString +
                   "\">Go to parent directory</a><br>");
 
-      DirectoryListing thisListing;
-      byte[] lastReturnedName = HdfsFileStatus.EMPTY_NAME;
-      do {	
-	  thisListing = dfs.listPaths(target, lastReturnedName);
-	  if (thisListing == null && lastReturnedName.length == 0) {
-		out.print("Empty directory");
-		break;
-	  }
-      HdfsFileStatus[] files = thisListing.getPartialListing();
-      if (files.length == 0 && lastReturnedName.length == 0) {
+      DirectoryListing thisListing = dfs.listPaths(target, HdfsFileStatus.EMPTY_NAME);
+      if (thisListing == null || thisListing.getPartialListing().length == 0) { 
         out.print("Empty directory");
       }
       else {
@@ -120,37 +112,42 @@
         int row=0;
         jspHelper.addTableRow(out, headings, row++);
         String cols [] = new String[headings.length];
-        for (int i = 0; i < files.length; i++) {
-          //Get the location of the first block of the file
-          String localname = files[i].getLocalName();
-          if (localname.endsWith(".crc")) continue;
-          if (!files[i].isDir()) {
-            cols[1] = "file";
-            cols[2] = StringUtils.byteDesc(files[i].getLen());
-            cols[3] = Short.toString(files[i].getReplication());
-            cols[4] = StringUtils.byteDesc(files[i].getBlockSize());
-          }
-          else {
-            cols[1] = "dir";
-            cols[2] = "";
-            cols[3] = "";
-            cols[4] = "";
-          }
-          String datanodeUrl = req.getRequestURL()+"?dir="+
+        do {
+          HdfsFileStatus[] files = thisListing.getPartialListing();
+          for (int i = 0; i < files.length; i++) {
+            //Get the location of the first block of the file
+            String localname = files[i].getLocalName();
+            if (localname.endsWith(".crc")) continue;
+            if (!files[i].isDir()) {
+              cols[1] = "file";
+              cols[2] = StringUtils.byteDesc(files[i].getLen());
+              cols[3] = Short.toString(files[i].getReplication());
+              cols[4] = StringUtils.byteDesc(files[i].getBlockSize());
+            }
+            else {
+              cols[1] = "dir";
+              cols[2] = "";
+              cols[3] = "";
+              cols[4] = "";
+            }
+            String datanodeUrl = req.getRequestURL()+"?dir="+
               URLEncoder.encode(files[i].getFullName(target).toString(), "UTF-8") + 
               "&namenodeInfoPort=" + namenodeInfoPort + JspHelper.SET_DELEGATION + 
               tokenString;
-          cols[0] = "<a href=\""+datanodeUrl+"\">"+localname+"</a>";
-          cols[5] = FsShell.dateForm.format(new Date((files[i].getModificationTime())));
-          cols[6] = files[i].getPermission().toString();
-          cols[7] = files[i].getOwner();
-          cols[8] = files[i].getGroup();
-          jspHelper.addTableRow(out, cols, row++);
-        }
+            cols[0] = "<a href=\""+datanodeUrl+"\">"+localname+"</a>";
+            cols[5] = FsShell.dateForm.format(new Date((files[i].getModificationTime())));
+            cols[6] = files[i].getPermission().toString();
+            cols[7] = files[i].getOwner();
+            cols[8] = files[i].getGroup();
+            jspHelper.addTableRow(out, cols, row++);
+          }
+          if (!thisListing.hasMore()) {
+            break;
+          }
+          thisListing = dfs.listPaths(target, thisListing.getLastName());
+        } while (thisListing != null);
         jspHelper.addTableFooter(out);
       }
-      lastReturnedName = thisListing.getLastName();
-      } while (thisListing.hasMore());
     } 
     String namenodeHost = jspHelper.nameNodeAddr.getHostName();
     out.print("<br><a href=\"http://" + 



Mime
View raw message