hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r1072023 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/INode.java src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
Date Fri, 18 Feb 2011 15:30:53 GMT
Author: szetszwo
Date: Fri Feb 18 15:30:53 2011
New Revision: 1072023

URL: http://svn.apache.org/viewvc?rev=1072023&view=rev
Log:
HDFS-1628. Display full path in AccessControlException.  Contributed by John George

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/INode.java
    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=1072023&r1=1072022&r2=1072023&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Fri Feb 18 15:30:53 2011
@@ -56,6 +56,9 @@ Trunk (unreleased changes)
     HDFS-1629. Add a method to BlockPlacementPolicy for keeping the chosen
     nodes in the output array.  (szetszwo)
 
+    HDFS-1628. Display full path in AccessControlException.  (John George
+    via szetszwo)
+
   OPTIMIZATIONS
 
     HDFS-1458. Improve checkpoint performance by avoiding unnecessary image

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/INode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/INode.java?rev=1072023&r1=1072022&r2=1072023&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/INode.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/INode.java Fri Feb 18
15:30:53 2011
@@ -231,6 +231,16 @@ abstract class INode implements Comparab
     return DFSUtil.bytes2String(name);
   }
 
+
+  String getLocalParentDir() {
+    INode p_node=getParent();
+
+    if(p_node == null)
+      return "/";
+    else
+      return p_node.getFullPathName();
+  }
+
   /**
    * Get local file name
    * @return local file name
@@ -261,7 +271,14 @@ abstract class INode implements Comparab
 
   /** {@inheritDoc} */
   public String toString() {
-    return "\"" + getLocalName() + "\":" + getPermissionStatus();
+    String i_path=getFullPathName();
+
+    if(i_path.length() == 0)
+      i_path="/";
+
+    return "\"" + i_path + "\":"
+    + getUserName() + ":" + getGroupName() + ":"
+    + (isDirectory()? "d": "-") + getFsPermission();
   }
 
   /**

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=1072023&r1=1072022&r2=1072023&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 Feb 18 15:30:53 2011
@@ -654,18 +654,6 @@ class NamenodeJspHelper {
       }
     }
 
-    private String getLocalParentDir(INode inode) {
-      StringBuilder pathBuf = new StringBuilder();
-      INode node = inode;
-      
-      // loop up to directory root, prepending each directory name to buffer
-      while ((node = node.getParent()) != null && node.getLocalName() != "") {
-        pathBuf.insert(0, '/').insert(0, node.getLocalName());
-      }
-
-      return pathBuf.toString();
-    }
-
     public void toXML(XMLOutputter doc) throws IOException {
       doc.startTag("block_info");
       if (block == null) {
@@ -689,7 +677,7 @@ class NamenodeJspHelper {
           doc.endTag();
 
           doc.startTag("local_directory");
-          doc.pcdata(getLocalParentDir(inode));
+          doc.pcdata(inode.getLocalParentDir());
           doc.endTag();
 
           doc.startTag("user_name");



Mime
View raw message