Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

fix infinite loop in test

Robert Muir7fef7d345d68
diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
index f2045c94eb2..a41db5238a0 100644
--- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
+++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
@@ -82,6 +82,7 @@ public class TestNumericQueryParser extends LuceneTestCase {
static void init() {
try {
LOCALE = randomLocale(random);
+ LOCALE = Locale.getDefault();
TIMEZONE = randomTimeZone(random);
DATE_STYLE = randomDateStyle(random);
TIME_STYLE = randomDateStyle(random);
@@ -91,7 +92,7 @@ public class TestNumericQueryParser extends LuceneTestCase {
NUMBER_FORMAT.setMaximumFractionDigits((random.nextInt() & 20) + 1);
NUMBER_FORMAT.setMinimumFractionDigits((random.nextInt() & 20) + 1);
NUMBER_FORMAT.setMaximumIntegerDigits((random.nextInt() & 20) + 1);
- NUMBER_FORMAT.setMinimumIntegerDigits((random.nextInt() & 20) + 1);
+ NUMBER_FORMAT.setMinimumIntegerDigits((random.nextInt() & 20) + 4); // the loop checks for < 1000, this is a must!
// assumes localized date pattern will have at least year, month, day, hour, minute
SimpleDateFormat dateFormat = (SimpleDateFormat) DateFormat.getDateTimeInstance(