瀏覽代碼

HADOOP-4335. Fix FsShell -ls for filesystems without owners/groups. Contributed
by David Phillips.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@705124 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 16 年之前
父節點
當前提交
d040986030
共有 2 個文件被更改,包括 7 次插入3 次删除
  1. 3 0
      CHANGES.txt
  2. 4 3
      src/core/org/apache/hadoop/fs/FsShell.java

+ 3 - 0
CHANGES.txt

@@ -931,6 +931,9 @@ Release 0.19.0 - Unreleased
 
     HADOOP-4053. Schedulers must be notified when jobs complete. (Amar Kamat via omalley)
 
+    HADOOP-4335. Fix FsShell -ls for filesystems without owners/groups. (David
+    Phillips via cdouglas)
+
 Release 0.18.2 - Unreleased
 
   BUG FIXES

+ 4 - 3
src/core/org/apache/hadoop/fs/FsShell.java

@@ -623,9 +623,10 @@ public class FsShell extends Configured implements Tool {
           stat.getPermission() + " ");
         System.out.printf("%"+ maxReplication + 
           "s ", (!stat.isDir() ? stat.getReplication() : "-"));
-        System.out.printf("%-"+ maxOwner +
-          "s ", stat.getOwner());
-        System.out.printf("%-"+ maxGroup +"s ", stat.getGroup());
+        if (maxOwner > 0)
+          System.out.printf("%-"+ maxOwner + "s ", stat.getOwner());
+        if (maxGroup > 0)
+          System.out.printf("%-"+ maxGroup + "s ", stat.getGroup());
         System.out.printf("%"+ maxLen + "d ", stat.getLen());
         System.out.print(mdate + " ");
         System.out.println(cur.toUri().getPath());