lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SOLR-2876) Precedence operator in conditionals with ternary operator needs to be examined.
Date Fri, 04 Nov 2011 12:13:01 GMT
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


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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message