Rishabh Patel created LUCENE-6602: ------------------------------------- Summary: Null value dereference Key: LUCENE-6602 URL: https://issues.apache.org/jira/browse/LUCENE-6602 Project: Lucene - Core Issue Type: Bug Components: modules/queryparser Affects Versions: Trunk Reporter: Rishabh Patel Priority: Minor
In the file BoostQueryNode.java, getChild could be null and it is being dereferenced in the function toString(). {code:title=BoostQueryNode.java|borderStyle=solid} public QueryNode getChild() { List<QueryNode> children = getChildren(); if (children == null || children.size() == 0) { return null; } return children.get(0); }{code} {code:title=BoostQueryNode.java|borderStyle=solid} public String toString() { return "<boost value='" + getValueString() + "'>" + "\n" + getChild().toString() + "\n</boost>"; } {code} Should we not check if getChild is valid? {code:title=Probable fix | borderStyle=solid} String s = (getChild() != null) ? getChild().toString() : "null"; return "<boost value='" + getValueString() + "'>" + "\n" + s + "\n</boost>"; {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org