mirror of https://github.com/apache/lucene.git
LUCENE-2466: fix some usages of the default locale that cause test failures under th_TH_TH
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@945343 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
62307cb0b5
commit
82bc123339
|
@ -56,7 +56,7 @@ public class DateUtil {
|
|||
private static final Date DEFAULT_TWO_DIGIT_YEAR_START;
|
||||
|
||||
static {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.US);
|
||||
calendar.set(2000, Calendar.JANUARY, 1, 0, 0);
|
||||
DEFAULT_TWO_DIGIT_YEAR_START = calendar.getTime();
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class DateUtil {
|
|||
public ThreadLocalDateFormat() {
|
||||
super();
|
||||
//2007-04-26T08:05:04Z
|
||||
SimpleDateFormat tmp = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
SimpleDateFormat tmp = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
|
||||
tmp.setTimeZone(UTC);
|
||||
proto = tmp;
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ public class CoreContainer
|
|||
schemaFile = new File(solrLoader.getInstanceDir() + "conf" + File.separator + dcore.getSchemaName());
|
||||
}
|
||||
if(schemaFile. exists()){
|
||||
String key = schemaFile.getAbsolutePath()+":"+new SimpleDateFormat("yyyyMMddhhmmss").format(new Date(schemaFile.lastModified()));
|
||||
String key = schemaFile.getAbsolutePath()+":"+new SimpleDateFormat("yyyyMMddhhmmss", Locale.US).format(new Date(schemaFile.lastModified()));
|
||||
schema = indexSchemaCache.get(key);
|
||||
if(schema == null){
|
||||
log.info("creating new schema object for core: " + dcore.name);
|
||||
|
|
|
@ -481,7 +481,7 @@ public class SnapPuller {
|
|||
* All the files are copied to a temp dir first
|
||||
*/
|
||||
private File createTempindexDir(SolrCore core) {
|
||||
String tmpIdxDirName = "index." + new SimpleDateFormat(SnapShooter.DATE_FMT).format(new Date());
|
||||
String tmpIdxDirName = "index." + new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.US).format(new Date());
|
||||
File tmpIdxDir = new File(core.getDataDir(), tmpIdxDirName);
|
||||
tmpIdxDir.mkdirs();
|
||||
return tmpIdxDir;
|
||||
|
@ -649,7 +649,7 @@ public class SnapPuller {
|
|||
}
|
||||
|
||||
private String getDateAsStr(Date d) {
|
||||
return new SimpleDateFormat(SnapShooter.DATE_FMT).format(d);
|
||||
return new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.US).format(d);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.io.IOException;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.lucene.index.IndexCommit;
|
||||
|
@ -76,7 +77,7 @@ public class SnapShooter {
|
|||
String directoryName = null;
|
||||
Lock lock = null;
|
||||
try {
|
||||
SimpleDateFormat fmt = new SimpleDateFormat(DATE_FMT);
|
||||
SimpleDateFormat fmt = new SimpleDateFormat(DATE_FMT, Locale.US);
|
||||
directoryName = "snapshot." + fmt.format(new Date());
|
||||
lock = lockFactory.makeLock(directoryName + ".lock");
|
||||
if (lock.isLocked()) return;
|
||||
|
|
|
@ -743,7 +743,7 @@ class JSONWriter extends TextResponseWriter {
|
|||
// builder's buffer.
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (cal==null) cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
if (cal==null) cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.US);
|
||||
cal.setTime(val);
|
||||
|
||||
int i = cal.get(Calendar.YEAR);
|
||||
|
|
|
@ -162,7 +162,7 @@ final public class XMLWriter {
|
|||
// temporary working objects...
|
||||
// be careful not to use these recursively...
|
||||
private final ArrayList tlst = new ArrayList();
|
||||
private final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
private final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.US);
|
||||
private final StringBuilder sb = new StringBuilder();
|
||||
|
||||
public XMLWriter(Writer writer, IndexSchema schema, SolrQueryRequest req, String version) {
|
||||
|
|
|
@ -171,7 +171,7 @@ public class TestTrie extends SolrTestCaseJ4 {
|
|||
assertQ("Range filter tint:[* to *] must match 10 documents", req("q", "*:*", "fq", "tdate:[* TO *]"), "//*[@numFound='10']");
|
||||
|
||||
// Test date math syntax
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
|
||||
format.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
|
||||
assertU(delQ("*:*"));
|
||||
|
@ -222,7 +222,7 @@ public class TestTrie extends SolrTestCaseJ4 {
|
|||
checkPrecisionSteps("tdate");
|
||||
|
||||
// For tdate tests
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
|
||||
format.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
DateMathParser dmp = new DateMathParser(DateField.UTC, Locale.US);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +44,7 @@ public class TestFaceting extends SolrTestCaseJ4 {
|
|||
}
|
||||
|
||||
String t(int tnum) {
|
||||
return String.format("%08d", tnum);
|
||||
return String.format(Locale.US, "%08d", tnum);
|
||||
}
|
||||
|
||||
void createIndex(int nTerms) {
|
||||
|
|
Loading…
Reference in New Issue