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("+");
|
buffer.append("+");
|
||||||
|
|
||||||
Query subQuery = c.getQuery();
|
Query subQuery = c.getQuery();
|
||||||
if (subQuery instanceof BooleanQuery) { // wrap sub-bools in parens
|
if (subQuery != null) {
|
||||||
buffer.append("(");
|
if (subQuery instanceof BooleanQuery) { // wrap sub-bools in parens
|
||||||
buffer.append(c.getQuery().toString(field));
|
buffer.append("(");
|
||||||
buffer.append(")");
|
buffer.append(subQuery.toString(field));
|
||||||
} else
|
buffer.append(")");
|
||||||
buffer.append(c.getQuery().toString(field));
|
} else {
|
||||||
|
buffer.append(subQuery.toString(field));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buffer.append("null");
|
||||||
|
}
|
||||||
|
|
||||||
if (i != clauses.size()-1)
|
if (i != clauses.size()-1)
|
||||||
buffer.append(" ");
|
buffer.append(" ");
|
||||||
|
|
Loading…
Reference in New Issue