Apache Lucene open-source search software
LUCENE-6723: Fix date parsing problems in Java 9 with date formats using English weekday/month names.
Uwe Schindler49c87c5715bc
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 05f003987a8..c7cb9f275a6 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -326,6 +326,9 @@ Bug fixes* LUCENE-6713: TooComplexToDeterminizeException claims to be serializablebut wasn't (Simon Willnauer, Mike McCandless)+* LUCENE-6723: Fix date parsing problems in Java 9 with date formats using+ English weekday/month names. (Uwe Schindler)+Changes in Runtime Behavior* LUCENE-6501: The subreader structure in ParallelCompositeReaderdiff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.javaindex c5667fdfba5..3950f9bc8d0 100644--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java@@ -177,7 +177,7 @@ public class DirContentSource extends ContentSource {dfi = new DateFormatInfo();dfi.pos = new ParsePosition(0);// date format: 30-MAR-1987 14:22:36.87- dfi.df = new SimpleDateFormat("dd-MMM-yyyy kk:mm:ss.SSS", Locale.ROOT);+ dfi.df = new SimpleDateFormat("dd-MMM-yyyy kk:mm:ss.SSS", Locale.ENGLISH);dfi.df.setLenient(true);dateFormat.set(dfi);}diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.javaindex 94b2eda6709..4c3de6deab2 100644--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java@@ -184,7 +184,7 @@ public class DocMaker implements Closeable {private boolean storeBytes = false;private static class DateUtil {- public SimpleDateFormat parser = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss", Locale.ROOT);+ public SimpleDateFormat parser = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss", Locale.ENGLISH);public Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.ROOT);public ParsePosition pos = new ParsePosition(0);public DateUtil() {diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.javaindex 0810cf06d75..31d41a1cfb0 100644--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java@@ -80,7 +80,7 @@ public class ReutersContentSource extends ContentSource {if (dfi == null) {dfi = new DateFormatInfo();// date format: 30-MAR-1987 14:22:36.87- dfi.df = new SimpleDateFormat("dd-MMM-yyyy kk:mm:ss.SSS",Locale.ROOT);+ dfi.df = new SimpleDateFormat("dd-MMM-yyyy kk:mm:ss.SSS",Locale.ENGLISH);dfi.df.setLenient(true);dfi.pos = new ParsePosition(0);dateFormat.set(dfi);diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.javaindex 8cb05bc149e..21ade912777 100644--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java@@ -105,7 +105,7 @@ public class TrecContentSource extends ContentSource {dfi = new DateFormatInfo();dfi.dfs = new SimpleDateFormat[DATE_FORMATS.length];for (int i = 0; i < dfi.dfs.length; i++) {- dfi.dfs[i] = new SimpleDateFormat(DATE_FORMATS[i], Locale.ROOT);+ dfi.dfs[i] = new SimpleDateFormat(DATE_FORMATS[i], Locale.ENGLISH);dfi.dfs[i].setLenient(true);}dfi.pos = new ParsePosition(0);diff --git a/solr/solrj/src/java/org/apache/solr/common/util/DateUtil.java b/solr/solrj/src/java/org/apache/solr/common/util/DateUtil.javaindex 49b7fc43f77..da4cd15a717 100644--- a/solr/solrj/src/java/org/apache/solr/common/util/DateUtil.java+++ b/solr/solrj/src/java/org/apache/solr/common/util/DateUtil.java@@ -147,7 +147,7 @@ public class DateUtil {while (formatIter.hasNext()) {String format = (String) formatIter.next();if (dateParser == null) {- dateParser = new SimpleDateFormat(format, Locale.ROOT);+ dateParser = new SimpleDateFormat(format, Locale.ENGLISH);dateParser.setTimeZone(GMT);dateParser.set2DigitYearStart(startDate);} else {