jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Parvulescu (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (OAK-286) Possible NPE in LuceneIndex
Date Wed, 29 Aug 2012 10:53:08 GMT

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

Alex Parvulescu edited comment on OAK-286 at 8/29/12 9:52 PM:
--------------------------------------------------------------

good point, but is taking out the entire Query creation a good idea?

what if {{first}} is null and {{last}} is not? we still need to have the {{TermRangeQuery.newStringRange}}
created with an upper bound - lucene seems to allow this.

so I'd move the null check as a first condition on the if:

{{if (first.equals(last) && pr.firstIncluding && pr.lastIncluding)}}

becomes

{{if (first !=null && first.equals(last) && pr.firstIncluding && pr.lastIncluding)}}

[edit] tweaked formatting a bit

                
      was (Author: alex.parvulescu):
    good point, but is taking out the entire Query creation a good idea?

what if first is null and last it not? we still need to have the TermRangeQuery.newStringRange
created with an upper bound - lucene seems to allow this.

so I'd move the null check as a first condition on the if:

{{if (first.equals(last) && pr.firstIncluding && pr.lastIncluding)}}

becomes

{{if (first !=null && first.equals(last) && pr.firstIncluding && pr.lastIncluding)}}



                  
> Possible NPE in LuceneIndex
> ---------------------------
>
>                 Key: OAK-286
>                 URL: https://issues.apache.org/jira/browse/OAK-286
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.4
>            Reporter: Tommaso Teofili
>            Priority: Trivial
>             Fix For: 0.5
>
>         Attachments: OAK-286.patch
>
>
> in LuceneIndex#getQuery(Filter) the first variable is initialized to null and updated
to a meaningful value only if pr.first is not null, thus it may result in NPE when calling
first.equals(last) (line 168).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message