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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to