lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r722897 - /lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java
Date Wed, 03 Dec 2008 14:15:22 GMT
Author: markrmiller
Date: Wed Dec  3 06:15:22 2008
New Revision: 722897

URL: http://svn.apache.org/viewvc?rev=722897&view=rev
Log:
LUCENE-1246: check for null sub queries so that BooleanQuery.toString does not throw NullPointerException.

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java?rev=722897&r1=722896&r2=722897&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java Wed Dec  3 06:15:22
2008
@@ -424,12 +424,17 @@
         buffer.append("+");
 
       Query subQuery = c.getQuery();
-      if (subQuery instanceof BooleanQuery) {	  // wrap sub-bools in parens
-        buffer.append("(");
-        buffer.append(c.getQuery().toString(field));
-        buffer.append(")");
-      } else
-        buffer.append(c.getQuery().toString(field));
+      if (subQuery != null) {
+        if (subQuery instanceof BooleanQuery) {	  // wrap sub-bools in parens
+          buffer.append("(");
+          buffer.append(subQuery.toString(field));
+          buffer.append(")");
+        } else {
+          buffer.append(subQuery.toString(field));
+        }
+      } else {
+        buffer.append("null");
+      }
 
       if (i != clauses.size()-1)
         buffer.append(" ");



Mime
View raw message