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

Erick Erickson commented on SOLR-2876:
--------------------------------------

I love it when a better solution occurs to me the instant I post something.....
\|\|[^\(]+==.*\?
                
> Precedence operator in conditionals with ternary operator needs to be 
> examined.
> -------------------------------------------------------------------------------
>
>                 Key: SOLR-2876
>                 URL: https://issues.apache.org/jira/browse/SOLR-2876
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 3.5, 4.0
>         Environment: all
>            Reporter: Erick Erickson
>            Assignee: Erick Erickson
>              Labels: operator, precedence, ternary
>
> This is an offshoot of 2829 where the root of the bug was that precedence in 
> the ternary operator along with && without appropriate parentheses was a 
> problem.
> && this.parser == null ? other.parser == null : this.parser.getClass() == 
> other.parser.getClass() (from ShortFieldSource.java).
> So that got me curious whether this pattern was repeated. A quick grep with 
> the following REs produced one hit I wasn't related to 2829 with && and more 
> with || (3x code base). I'll try to get to it over the weekend. Please don't 
> grab it just yet, I'm fixing this partially for 2829, but if anyone wants to 
> try the grep and see if I'm hallucinating, I'd appreciate it. I'd *really* 
> appreciate any tests for things people see...
> Some of the returns are false hits, but not others. See 
> SolrIndexSearcher.getDocListAndSetNC() 
> the last line is: return pf.filter==null && pf.postFilter==null ? 
> qr.getDocSet() : null; 
> REs (using them in IntelliJ)
> \|\|[\sa-z\.0-9A-Z]+==.*\?
> &&[\sa-z\.0-9A-Z]+==.*\?
> I got some hits with the above and didn't pursue it any further, but if 
> anyone wants to suggest more comprehensive REs, please attach. I'm trying for 
> "&& or || followed by anything without an open parentheses followed by == 
> followed by anything followed by ?" I'd rather get a manageable number of 
> false positives than miss things.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to