You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Amrit Sarkar (JIRA)" <ji...@apache.org> on 2017/05/07 09:42:04 UTC

[jira] [Commented] (SOLR-10621) Suspicious condition

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

Amrit Sarkar commented on SOLR-10621:
-------------------------------------

That's a legit code bug, wonder how it was not reported till now.

> Suspicious condition
> --------------------
>
>                 Key: SOLR-10621
>                 URL: https://issues.apache.org/jira/browse/SOLR-10621
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: query parsers
>    Affects Versions: 6.5
>            Reporter: AppChecker
>              Labels: static-analysis
>
> Hi
> Please, look this [code fragment:|https://github.com/apache/lucene-solr/blob/e2521b2a8baabdaf43b92192588f51e042d21e97/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/util/QueryNodeOperation.java#L57-L60]
> {code}
>     else if (q1 instanceof AndQueryNode)
>       op = ANDOperation.Q1;
>     else if (q1 instanceof AndQueryNode)
>       op = ANDOperation.Q2;
> {code}
> (q1 instanceof AndQueryNode) is checked twice.
> Probably it should be:
> {code}
>     else if (q1 instanceof AndQueryNode)
>       op = ANDOperation.Q1;
>     else if (q2 instanceof AndQueryNode)
>       op = ANDOperation.Q2;
> {code}
> This possible defect found by [AppChecker|https://npo-echelon.ru/en/solutions/appchecker.php]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org