LUCENE-689: NullPointerException thrown by equals method in SpanOrQuery

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@750009 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2009-03-04 13:50:06 +00:00
parent 90f52a651e
commit 480c2afd15
2 changed files with 5 additions and 1 deletions

View File

@ -121,7 +121,7 @@ public class SpanOrQuery extends SpanQuery {
final SpanOrQuery that = (SpanOrQuery) o;
if (!clauses.equals(that.clauses)) return false;
if (!field.equals(that.field)) return false;
if (!clauses.isEmpty() && !field.equals(that.field)) return false;
return getBoost() == that.getBoost();
}

View File

@ -318,6 +318,10 @@ public class TestSpans extends LuceneTestCase {
public void testSpanOrEmpty() throws Exception {
Spans spans = orSpans(new String[0]);
assertFalse("empty next", spans.next());
SpanOrQuery a = new SpanOrQuery( new SpanQuery[0] );
SpanOrQuery b = new SpanOrQuery( new SpanQuery[0] );
assertTrue("empty should equal", a.equals(b));
}
public void testSpanOrSingle() throws Exception {