lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: TestRegexpRandom2
Date Mon, 26 Jul 2010 17:32:52 GMT
Hmm that doesn't fix it.

The magical seed is: 50686536365145364L (for TRR2).

I still see the IAE even if I remove that RegExp.NONE.

Mike

On Mon, Jul 26, 2010 at 1:28 PM, Robert Muir <rcmuir@gmail.com> wrote:
> I don't think we should do that. I think i found the problem:
> AutomatonTestUtil's randomRegexp does this:
>       try {
>         return new RegExp(regexp, RegExp.NONE);
>       } catch (Exception e) {}
> I think the RegExp.NONE is the problem, and we should remove it.
> because the test then toString's it and compiles it again, but without this
> option.
> On Mon, Jul 26, 2010 at 1:16 PM, Michael McCandless
> <lucene@mikemccandless.com> wrote:
>>
>> My random stress testing hit an IllegalArgExc because the random
>> regexp was malformed.
>>
>> Does this patch look OK to fix?
>>
>> Index: src/test/org/apache/lucene/search/TestRegexpRandom2.java
>> ===================================================================
>> --- src/test/org/apache/lucene/search/TestRegexpRandom2.java    (revision
>> 979227)
>> +++ src/test/org/apache/lucene/search/TestRegexpRandom2.java    (working
>> copy)
>> @@ -130,6 +130,14 @@
>>    * simple regexpquery implementation.
>>    */
>>   private void assertSame(String regexp) throws IOException {
>> +    try {
>> +      new RegExp(regexp);
>> +    } catch (IllegalArgumentException iae) {
>> +      // the random regexp could be malformed, eg "foo"bar",
>> +      // so we ignore this
>> +      return;
>> +    }
>> +
>>     RegexpQuery smart = new RegexpQuery(new Term("field", regexp));
>>     DumbRegexpQuery dumb = new DumbRegexpQuery(new Term("field", regexp));
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>
>
>
> --
> Robert Muir
> rcmuir@gmail.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message