lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-6602) Null value dereference
Date Thu, 25 Jun 2015 03:04:06 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-6602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14600596#comment-14600596
] 

ASF GitHub Bot commented on LUCENE-6602:
----------------------------------------

GitHub user rmp91 opened a pull request:

    https://github.com/apache/lucene-solr/pull/159

    LUCENE-6602: Checking for null getChild() before getChild.toString()

    https://issues.apache.org/jira/browse/LUCENE-6602

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rmp91/lucene-solr LUCENE-6602

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/lucene-solr/pull/159.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #159
    
----
commit 3b8874be7c365f68bfbec204ab7043b4fe6098ad
Author: Rishabh <rishabh.mahendra.patel@gmail.com>
Date:   2015-06-25T02:47:38Z

    LUCENE-6602: Added a check for Null value, before executing getChild.toString()

----


> 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
>   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


Mime
View raw message