Open
Description
In the file BoostQueryNode.java
, getChild
could be null and it is being dereferenced in the function toString()
.
public QueryNode getChild() {
List<QueryNode> children = getChildren();
if (children == null || children.size() == 0) {
return null;
}
return children.get(0);
}
public String toString() {
return "<boost value='" + getValueString() + "'>" + "\n"
+ getChild().toString() + "\n</boost>";
}
Should we not check if getChild is valid?
String s = (getChild() != null) ? getChild().toString() : "null";
return "<boost value='" + getValueString() + "'>" + "\n"
+ s + "\n</boost>";
Migrated from LUCENE-6602 by Rishabh Patel, updated May 09 2016