Apache Lucene open-source search software
LUCENE-4135: checkDateFormatSanity needs to handle ParseException
Robert Muiree0d911d77ac
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestNumericQueryParser.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestNumericQueryParser.javaindex c8d08552927..082db96861d 100644--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestNumericQueryParser.java+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestNumericQueryParser.java@@ -88,10 +88,13 @@ public class TestNumericQueryParser extends LuceneTestCase {private static IndexReader reader = null;private static IndexSearcher searcher = null;- private static boolean checkDateFormatSanity(DateFormat dateFormat, long date)- throws ParseException {- return date == dateFormat.parse(dateFormat.format(new Date(date)))+ private static boolean checkDateFormatSanity(DateFormat dateFormat, long date) {+ try {+ return date == dateFormat.parse(dateFormat.format(new Date(date))).getTime();+ } catch (ParseException e) {+ return false;+ }}@BeforeClass