LUCENE-4199: add default local DecimalFormat ctors

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1359238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-07-09 16:03:57 +00:00
parent 3582fea429
commit 4138528889
6 changed files with 16 additions and 5 deletions

View File

@ -28,6 +28,8 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import java.util.Random;
/** Test that BooleanQuery.setMinimumNumberShouldMatch works.
@ -377,7 +379,7 @@ public class TestBooleanMinShouldMatch extends LuceneTestCase {
System.err.println("------- " + test + " -------");
DecimalFormat f = new DecimalFormat("0.000000");
DecimalFormat f = new DecimalFormat("0.000000", DecimalFormatSymbols.getInstance(Locale.ROOT));
for (int i = 0; i < h.length; i++) {
Document d = searcher.doc(h[i].doc);

View File

@ -35,6 +35,8 @@ import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.store.Directory;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import java.io.IOException;
/**
@ -485,7 +487,7 @@ public class TestDisjunctionMaxQuery extends LuceneTestCase {
System.err.println("------- " + test + " -------");
DecimalFormat f = new DecimalFormat("0.000000000");
DecimalFormat f = new DecimalFormat("0.000000000", DecimalFormatSymbols.getInstance(Locale.ROOT));
for (int i = 0; i < h.length; i++) {
Document d = searcher.doc(h[i].doc);

View File

@ -23,9 +23,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import org.apache.lucene.store.FSDirectory;
@ -97,7 +99,7 @@ public class IndexSplitter {
}
public void listSegments() throws IOException {
DecimalFormat formatter = new DecimalFormat("###,###.###");
DecimalFormat formatter = new DecimalFormat("###,###.###", DecimalFormatSymbols.getInstance(Locale.ROOT));
for (int x = 0; x < infos.size(); x++) {
SegmentInfoPerCommit info = infos.info(x);
String sizeStr = formatter.format(info.sizeInBytes());

View File

@ -18,7 +18,9 @@ package org.apache.lucene.index;
*/
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.util.Locale;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
@ -32,7 +34,7 @@ import org.apache.lucene.util.LuceneTestCase;
public class TestPKIndexSplitter extends LuceneTestCase {
public void testSplit() throws Exception {
NumberFormat format = new DecimalFormat("000000000");
NumberFormat format = new DecimalFormat("000000000", DecimalFormatSymbols.getInstance(Locale.ROOT));
Directory dir = newDirectory();
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false))

View File

@ -42,6 +42,8 @@ java.text.DateFormat#getDateTimeInstance(int,int)
java.text.DateFormat#getInstance()
java.text.DateFormatSymbols#<init>()
java.text.DateFormatSymbols#getInstance()
java.text.DecimalFormat#<init>()
java.text.DecimalFormat#<init>(java.lang.String)
java.text.DecimalFormatSymbols#<init>()
java.text.DecimalFormatSymbols#getInstance()
java.text.MessageFormat#<init>(java.lang.String)

View File

@ -28,6 +28,7 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.charset.Charset;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Date;
import java.util.Locale;
@ -210,7 +211,7 @@ public class SystemInfoHandler extends RequestHandlerBase
jvm.add( "processors", runtime.availableProcessors() );
// not thread safe, but could be thread local
DecimalFormat df = new DecimalFormat("#.#");
DecimalFormat df = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.ROOT));
SimpleOrderedMap<Object> mem = new SimpleOrderedMap<Object>();
SimpleOrderedMap<Object> raw = new SimpleOrderedMap<Object>();