An incomplete fix for the NPE bugs in NearSpansUnordered.java
-------------------------------------------------------------

                 Key: LUCENE-3783
                 URL: https://issues.apache.org/jira/browse/LUCENE-3783
             Project: Lucene - Java
          Issue Type: Bug
          Components: core/search
    Affects Versions: 3.0
            Reporter: Guangtai Liang


The fix revision 698487 was aimed to remove an NPE bug (LUCENE-1404) on the 
returned value  of  "min()" in the method "isPayloadAvailable" of the file 
"/lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java"
 , but it is incomplete. 

Since the  returned value  "min()" could be null during the runtime execution, 
its value should also be null-checked before being dereferenced in other 
methods. 

The buggy code locations the same fix needs to be applied at are as bellows: 
 
Lines 159 , 170 , and 196 of the methods "next()" 
Line 216 of the methods "skipTo()"
Line 230 of the methods "doc()"
230  public int doc() { return min().doc(); }

Line 232 of the methods "start()"
232  public int start() { return min().start(); }

Line 315 of the methods "atMatch()"
        private boolean atMatch() {
315    return (min().doc() == max.doc())
                && ((max.end() - min().start() - totalLength) <= slop);
          }


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

Reply via email to