here's a change that makes the test reproducible (run it a few times
and eventually you get a problematic locale/tz, then the seed will
reproduce the problem):

Index: 
lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
===================================================================
--- 
lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
      (revision
1145431)
+++ 
lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
      (working
copy)
@@ -63,26 +63,30 @@

   final private static int PRECISION_STEP = 8;
   final private static String FIELD_NAME = "field";
-  final private static Locale LOCALE = randomLocale(random);
-  final private static TimeZone TIMEZONE = randomTimeZone(random);
-  final private static Map<String,Number> RANDOM_NUMBER_MAP;
+  private static Locale LOCALE;
+  private static TimeZone TIMEZONE;
+  private static Map<String,Number> RANDOM_NUMBER_MAP;
   final private static EscapeQuerySyntax ESCAPER = new EscapeQuerySyntaxImpl();
   final private static String DATE_FIELD_NAME = "date";
-  final private static int DATE_STYLE = randomDateStyle(random);
-  final private static int TIME_STYLE = randomDateStyle(random);
+  private static int DATE_STYLE;
+  private static int TIME_STYLE;
+  private static Analyzer ANALYZER;

-  final private static Analyzer ANALYZER = new MockAnalyzer(random);
+  private static NumberFormat NUMBER_FORMAT;

-  final private static NumberFormat NUMBER_FORMAT = NumberFormat
-      .getNumberInstance(LOCALE);
+  private static StandardQueryParser qp;

-  final private static StandardQueryParser qp = new StandardQueryParser(
-      ANALYZER);
+  private static NumberDateFormat DATE_FORMAT;

-  final private static NumberDateFormat DATE_FORMAT;
-
-  static {
+  static void initFormats() {
     try {
+      LOCALE = randomLocale(random);
+      TIMEZONE = randomTimeZone(random);
+      DATE_STYLE = randomDateStyle(random);
+      TIME_STYLE = randomDateStyle(random);
+      ANALYZER = new MockAnalyzer(random);
+      NUMBER_FORMAT = NumberFormat.getNumberInstance(LOCALE);
+      qp = new StandardQueryParser(ANALYZER);
       NUMBER_FORMAT.setMaximumFractionDigits((random.nextInt() & 20) + 1);
       NUMBER_FORMAT.setMinimumFractionDigits((random.nextInt() & 20) + 1);
       NUMBER_FORMAT.setMaximumIntegerDigits((random.nextInt() & 20) + 1);
@@ -145,6 +149,7 @@

   @BeforeClass
   public static void beforeClass() throws Exception {
+    initFormats();
     directory = newDirectory();
     RandomIndexWriter writer = new RandomIndexWriter(random, directory,
         newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))


On Mon, Jul 11, 2011 at 10:30 PM, Robert Muir <[email protected]> wrote:
> I think this test has incorrect randomization, because it initializes
> its random locale and timezone statically (not in @beforeclass).
>
> You can see this by running the test, it has the same timezone every time.
>
> On Mon, Jul 11, 2011 at 10:18 PM, Chris Male <[email protected]> wrote:
>> I'm seeing this locally as well.
>>
>> On Tue, Jul 12, 2011 at 1:55 PM, Apache Jenkins Server
>> <[email protected]> wrote:
>>>
>>> Build: https://builds.apache.org/job/Lucene-Solr-tests-only-trunk/9507/
>>>
>>> 2 tests failed.
>>> REGRESSION:
>>>  org.apache.lucene.queryParser.standard.TestNumericQueryParser.testInclusiveNumericRange
>>>
>>> Error Message:
>>> null
>>>
>>> Stack Trace:
>>> java.lang.NullPointerException
>>>        at
>>> org.apache.lucene.queryParser.standard.config.NumberDateFormat.parse(NumberDateFormat.java:50)
>>>        at java.text.NumberFormat.parse(NumberFormat.java:348)
>>>        at
>>> org.apache.lucene.queryParser.standard.processors.NumericRangeQueryNodeProcessor.postProcessNode(NumericRangeQueryNodeProcessor.java:72)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processIteration(QueryNodeProcessorImpl.java:98)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processChildren(QueryNodeProcessorImpl.java:124)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processIteration(QueryNodeProcessorImpl.java:96)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processChildren(QueryNodeProcessorImpl.java:124)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processIteration(QueryNodeProcessorImpl.java:96)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.process(QueryNodeProcessorImpl.java:89)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorPipeline.process(QueryNodeProcessorPipeline.java:88)
>>>        at
>>> org.apache.lucene.queryParser.core.QueryParserHelper.parse(QueryParserHelper.java:254)
>>>        at
>>> org.apache.lucene.queryParser.standard.StandardQueryParser.parse(StandardQueryParser.java:166)
>>>        at
>>> org.apache.lucene.queryParser.standard.TestNumericQueryParser.testQuery(TestNumericQueryParser.java:385)
>>>        at
>>> org.apache.lucene.queryParser.standard.TestNumericQueryParser.assertRangeQuery(TestNumericQueryParser.java:356)
>>>        at
>>> org.apache.lucene.queryParser.standard.TestNumericQueryParser.testInclusiveNumericRange(TestNumericQueryParser.java:282)
>>>        at
>>> org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:1464)
>>>        at
>>> org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:1382)
>>>
>>>
>>> REGRESSION:
>>>  org.apache.lucene.queryParser.standard.TestNumericQueryParser.testExclusiveNumericRange
>>>
>>> Error Message:
>>> null
>>>
>>> Stack Trace:
>>> java.lang.NullPointerException
>>>        at
>>> org.apache.lucene.queryParser.standard.config.NumberDateFormat.parse(NumberDateFormat.java:50)
>>>        at java.text.NumberFormat.parse(NumberFormat.java:348)
>>>        at
>>> org.apache.lucene.queryParser.standard.processors.NumericRangeQueryNodeProcessor.postProcessNode(NumericRangeQueryNodeProcessor.java:72)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processIteration(QueryNodeProcessorImpl.java:98)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processChildren(QueryNodeProcessorImpl.java:124)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processIteration(QueryNodeProcessorImpl.java:96)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processChildren(QueryNodeProcessorImpl.java:124)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.processIteration(QueryNodeProcessorImpl.java:96)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorImpl.process(QueryNodeProcessorImpl.java:89)
>>>        at
>>> org.apache.lucene.queryParser.core.processors.QueryNodeProcessorPipeline.process(QueryNodeProcessorPipeline.java:88)
>>>        at
>>> org.apache.lucene.queryParser.core.QueryParserHelper.parse(QueryParserHelper.java:254)
>>>        at
>>> org.apache.lucene.queryParser.standard.StandardQueryParser.parse(StandardQueryParser.java:166)
>>>        at
>>> org.apache.lucene.queryParser.standard.TestNumericQueryParser.testQuery(TestNumericQueryParser.java:385)
>>>        at
>>> org.apache.lucene.queryParser.standard.TestNumericQueryParser.assertRangeQuery(TestNumericQueryParser.java:356)
>>>        at
>>> org.apache.lucene.queryParser.standard.TestNumericQueryParser.testExclusiveNumericRange(TestNumericQueryParser.java:311)
>>>        at
>>> org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:1464)
>>>        at
>>> org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:1382)
>>>
>>>
>>>
>>>
>>> Build Log (for compile errors):
>>> [...truncated 3344 lines...]
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>
>>
>>
>> --
>> Chris Male | Software Developer | JTeam BV.| www.jteam.nl
>>
>
>
>
> --
> lucidimagination.com
>



-- 
lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to