소스 검색

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 년 전
부모
커밋
c114d88262
2개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  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
     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
 
     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.InputStream;
 import java.text.DecimalFormat;
+import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 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 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("#.##");
+  }
 
   /**
    */