From ee0d911d77acb1ebffcf5ed9ecf160524a23c39b Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Wed, 13 Jun 2012 18:59:22 +0000 Subject: [PATCH] LUCENE-4135: checkDateFormatSanity needs to handle ParseException git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1349992 13f79535-47bb-0310-9956-ffa450edef68 --- .../flexible/standard/TestNumericQueryParser.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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.java index 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