hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1355085 - in /hadoop/common/trunk/hadoop-common-project/hadoop-common: CHANGES.txt src/main/java/org/apache/hadoop/fs/shell/Ls.java
Date Thu, 28 Jun 2012 17:42:45 GMT
Author: tucu
Date: Thu Jun 28 17:42:44 2012
New Revision: 1355085

URL: http://svn.apache.org/viewvc?rev=1355085&view=rev
Log:
HADOOP-8168. empty-string owners or groups causes {{MissingFormatWidthException}} in o.a.h.fs.shell.Ls.ProcessPath()
(ekoontz via tucu)

Modified:
    hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1355085&r1=1355084&r2=1355085&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Thu Jun 28 17:42:44
2012
@@ -270,6 +270,9 @@ Branch-2 ( Unreleased changes )
     HADOOP-8512. AuthenticatedURL should reset the Token when the server returns 
     other than OK on authentication (tucu)
 
+    HADOOP-8168. empty-string owners or groups causes {{MissingFormatWidthException}} 
+    in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu)
+
   BREAKDOWN OF HDFS-3042 SUBTASKS
 
     HADOOP-8220. ZKFailoverController doesn't handle failure to become active

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java?rev=1355085&r1=1355084&r2=1355085&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
Thu Jun 28 17:42:44 2012
@@ -134,8 +134,11 @@ class Ls extends FsCommand {
     StringBuilder fmt = new StringBuilder();
     fmt.append("%s%s "); // permission string
     fmt.append("%"  + maxRepl  + "s ");
-    fmt.append("%-" + maxOwner + "s ");
-    fmt.append("%-" + maxGroup + "s ");
+    // Do not use '%-0s' as a formatting conversion, since it will throw a
+    // a MissingFormatWidthException if it is used in String.format().
+    // http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html#intFlags
+    fmt.append((maxOwner > 0) ? "%-" + maxOwner + "s " : "%s");
+    fmt.append((maxGroup > 0) ? "%-" + maxGroup + "s " : "%s");
     fmt.append("%"  + maxLen   + "s ");
     fmt.append("%s %s"); // mod time & path
     lineFormat = fmt.toString();



Mime
View raw message