You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Rishabh Patel (JIRA)" <ji...@apache.org> on 2015/06/26 23:00:06 UTC
[jira] [Updated] (LUCENE-6602) Null value dereference
[ https://issues.apache.org/jira/browse/LUCENE-6602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rishabh Patel updated LUCENE-6602:
----------------------------------
Lucene Fields: New,Patch Available (was: New)
Labels: github-pullrequest (was: )
> 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
> Labels: github-pullrequest
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org