lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r960367 - in /lucene/dev/trunk/lucene: CHANGES.txt src/java/org/apache/lucene/search/MultiPhraseQuery.java src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
Date Sun, 04 Jul 2010 17:32:56 GMT
Author: mikemccand
Date: Sun Jul  4 17:32:56 2010
New Revision: 960367

URL: http://svn.apache.org/viewvc?rev=960367&view=rev
Log:
LUCENE-2526: don't throw NPE from MultiPhraseQuery.toString if it has no terms

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=960367&r1=960366&r2=960367&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Sun Jul  4 17:32:56 2010
@@ -474,6 +474,9 @@ New features
   to wrap any other Analyzer and provide the same functionality as
   MaxFieldLength provided on IndexWriter.  This patch also fixes a bug
   in the offset calculation in CharTokenizer. (Uwe Schindler, Shai Erera)
+
+* LUCENE-2526: Don't throw NPE from MultiPhraseQuery.toString when
+  it's empty.  (Ross Woolf via Mike McCandless)
   
 Optimizations
 

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java?rev=960367&r1=960366&r2=960367&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java Sun Jul
 4 17:32:56 2010
@@ -336,7 +336,7 @@ public class MultiPhraseQuery extends Qu
   @Override
   public final String toString(String f) {
     StringBuilder buffer = new StringBuilder();
-    if (!field.equals(f)) {
+    if (field == null || !field.equals(f)) {
       buffer.append(field);
       buffer.append(":");
     }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java?rev=960367&r1=960366&r2=960367&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java Sun
Jul  4 17:32:56 2010
@@ -263,4 +263,9 @@ public class TestMultiPhraseQuery extend
     writer.addDocument(doc);
   }
 
+  // LUCENE-2526
+  public void testEmptyToString() {
+    new MultiPhraseQuery().toString();
+  }
+
 }



Mime
View raw message