mirror of https://github.com/apache/lucene.git
LUCENE-1246: check for null sub queries so that BooleanQuery.toString does not throw NullPointerException.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@722897 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cfef10bb9d
commit
139f71599e
|
@ -424,12 +424,17 @@ public class BooleanQuery extends Query {
|
|||
buffer.append("+");
|
||||
|
||||
Query subQuery = c.getQuery();
|
||||
if (subQuery != null) {
|
||||
if (subQuery instanceof BooleanQuery) { // wrap sub-bools in parens
|
||||
buffer.append("(");
|
||||
buffer.append(c.getQuery().toString(field));
|
||||
buffer.append(subQuery.toString(field));
|
||||
buffer.append(")");
|
||||
} else
|
||||
buffer.append(c.getQuery().toString(field));
|
||||
} else {
|
||||
buffer.append(subQuery.toString(field));
|
||||
}
|
||||
} else {
|
||||
buffer.append("null");
|
||||
}
|
||||
|
||||
if (i != clauses.size()-1)
|
||||
buffer.append(" ");
|
||||
|
|
Loading…
Reference in New Issue