lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r750009 - in /lucene/java/trunk/src: java/org/apache/lucene/search/spans/SpanOrQuery.java test/org/apache/lucene/search/spans/TestSpans.java
Date Wed, 04 Mar 2009 13:50:07 GMT
Author: markrmiller
Date: Wed Mar  4 13:50:06 2009
New Revision: 750009

URL: http://svn.apache.org/viewvc?rev=750009&view=rev
Log:
LUCENE-689: NullPointerException thrown by equals method in SpanOrQuery

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestSpans.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java?rev=750009&r1=750008&r2=750009&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java Wed Mar  4
13:50:06 2009
@@ -121,7 +121,7 @@
     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();
   }

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestSpans.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestSpans.java?rev=750009&r1=750008&r2=750009&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestSpans.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestSpans.java Wed Mar  4 13:50:06
2009
@@ -318,6 +318,10 @@
   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 {



Mime
View raw message