Index: contrib/analyzers/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java =================================================================== --- contrib/analyzers/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java (revision 806943) +++ contrib/analyzers/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java (working copy) @@ -19,6 +19,7 @@ import java.io.IOException; import java.io.StringReader; import java.text.SimpleDateFormat; +import java.util.Locale; import junit.framework.TestCase; @@ -41,7 +42,7 @@ } public void test() throws IOException { - DateRecognizerSinkFilter sinkFilter = new DateRecognizerSinkFilter(new SimpleDateFormat("MM/dd/yyyy")); + DateRecognizerSinkFilter sinkFilter = new DateRecognizerSinkFilter(new SimpleDateFormat("MM/dd/yyyy", Locale.US)); String test = "The quick red fox jumped over the lazy brown dogs on 7/11/2006 The dogs finally reacted on 7/12/2006"; TeeSinkTokenFilter tee = new TeeSinkTokenFilter(new WhitespaceTokenizer(new StringReader(test))); SinkTokenStream sink = tee.newSinkTokenStream(sinkFilter); Index: src/java/org/apache/lucene/document/DateTools.java =================================================================== --- src/java/org/apache/lucene/document/DateTools.java (revision 806943) +++ src/java/org/apache/lucene/document/DateTools.java (working copy) @@ -22,6 +22,7 @@ import java.util.Calendar; import java.util.Date; import java.util.TimeZone; +import java.util.Locale; import org.apache.lucene.search.NumericRangeQuery; // for javadocs import org.apache.lucene.util.NumericUtils; // for javadocs @@ -52,13 +53,13 @@ private final static TimeZone GMT = TimeZone.getTimeZone("GMT"); - private static final SimpleDateFormat YEAR_FORMAT = new SimpleDateFormat("yyyy"); - private static final SimpleDateFormat MONTH_FORMAT = new SimpleDateFormat("yyyyMM"); - private static final SimpleDateFormat DAY_FORMAT = new SimpleDateFormat("yyyyMMdd"); - private static final SimpleDateFormat HOUR_FORMAT = new SimpleDateFormat("yyyyMMddHH"); - private static final SimpleDateFormat MINUTE_FORMAT = new SimpleDateFormat("yyyyMMddHHmm"); - private static final SimpleDateFormat SECOND_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss"); - private static final SimpleDateFormat MILLISECOND_FORMAT = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + private static final SimpleDateFormat YEAR_FORMAT = new SimpleDateFormat("yyyy", Locale.US); + private static final SimpleDateFormat MONTH_FORMAT = new SimpleDateFormat("yyyyMM", Locale.US); + private static final SimpleDateFormat DAY_FORMAT = new SimpleDateFormat("yyyyMMdd", Locale.US); + private static final SimpleDateFormat HOUR_FORMAT = new SimpleDateFormat("yyyyMMddHH", Locale.US); + private static final SimpleDateFormat MINUTE_FORMAT = new SimpleDateFormat("yyyyMMddHHmm", Locale.US); + private static final SimpleDateFormat SECOND_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US); + private static final SimpleDateFormat MILLISECOND_FORMAT = new SimpleDateFormat("yyyyMMddHHmmssSSS", Locale.US); static { // times need to be normalized so the value doesn't depend on the // location the index is created/used: Index: src/test/org/apache/lucene/document/TestDateTools.java =================================================================== --- src/test/org/apache/lucene/document/TestDateTools.java (revision 806943) +++ src/test/org/apache/lucene/document/TestDateTools.java (working copy) @@ -5,6 +5,7 @@ import java.util.Calendar; import java.util.Date; import java.util.TimeZone; +import java.util.Locale; import org.apache.lucene.util.LuceneTestCase; @@ -172,7 +173,7 @@ } private String isoFormat(Date date) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS", Locale.US); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); return sdf.format(date); }