Bläddra i källkod

HADOOP-2456. Hardcode English locale to prevent NumberFormatException from occurring when starting the NameNode with certain locales. Contributed by Matthias Friedrich.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@607325 13f79535-47bb-0310-9956-ffa450edef68
Nigel Daley 17 år sedan
förälder
incheckning
c114d88262
2 ändrade filer med 11 tillägg och 1 borttagningar
  1. 4 0
      CHANGES.txt
  2. 7 1
      src/java/org/apache/hadoop/fs/FsShell.java

+ 4 - 0
CHANGES.txt

@@ -345,6 +345,10 @@ Branch 0.15 (unreleased)
     for merging, this patch will ensure that only those files whose checksums
     for merging, this patch will ensure that only those files whose checksums
     have also got created (renamed) are returned. (ddas)
     have also got created (renamed) are returned. (ddas)
 
 
+    HADOOP-2456. Hardcode English locale to prevent NumberFormatException
+    from occurring when starting the NameNode with certain locales.
+    (Matthias Friedrich via nigel)
+
   IMPROVEMENTS
   IMPROVEMENTS
 
 
     HADOOP-2160.  Remove project-level, non-user documentation from
     HADOOP-2160.  Remove project-level, non-user documentation from

+ 7 - 1
src/java/org/apache/hadoop/fs/FsShell.java

@@ -21,6 +21,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStream;
 import java.text.DecimalFormat;
 import java.text.DecimalFormat;
+import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPInputStream;
@@ -53,7 +54,12 @@ public class FsShell extends Configured implements Tool {
   }
   }
   static final String SETREP_SHORT_USAGE="-setrep [-R] [-w] <rep> <path/file>";
   static final String SETREP_SHORT_USAGE="-setrep [-R] [-w] <rep> <path/file>";
   static final String TAIL_USAGE="-tail [-f] <file>";
   static final String TAIL_USAGE="-tail [-f] <file>";
-  private static final DecimalFormat decimalFormat = new DecimalFormat("#.##");
+  private static final DecimalFormat decimalFormat;
+  static {
+	  NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.ENGLISH);
+	  decimalFormat = (DecimalFormat) numberFormat;
+	  decimalFormat.applyPattern("#.##");
+  }
 
 
   /**
   /**
    */
    */