You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2008/09/24 11:49:44 UTC

[jira] Resolved: (LUCENE-1404) NPE in NearSpansUnordered.isPayloadAvailable()

     [ https://issues.apache.org/jira/browse/LUCENE-1404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-1404.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.9

Committed revision 698487 on trunk and 698488 on 2.4 branch.  Thanks Tim!

> NPE in NearSpansUnordered.isPayloadAvailable() 
> -----------------------------------------------
>
>                 Key: LUCENE-1404
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1404
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Query/Scoring
>    Affects Versions: 2.4
>            Reporter: Tim Smith
>            Assignee: Michael McCandless
>             Fix For: 2.4, 2.9
>
>         Attachments: SpanQueryTest.java
>
>
> Using RC1 of lucene 2.4 resulted in null pointer exception with some constructed SpanNearQueries
> Implementation of isPayloadAvailable() (results in exception)
> {code}
>  public boolean isPayloadAvailable() {
>    SpansCell pointer = min();
>    do {
>      if(pointer.isPayloadAvailable()) {
>        return true;
>      }
>      pointer = pointer.next;
>    } while(pointer.next != null);
>    return false;
>   }
> {code}
> "Fixed" isPayloadAvailable()
> {code}
>  public boolean isPayloadAvailable() {
>    SpansCell pointer = min();
>    while (pointer != null) {
>      if(pointer.isPayloadAvailable()) {
>        return true;
>      }
>      pointer = pointer.next;
>    }
>    return false;
>   }
> {code}
> Exception produced:
> {code}
>   [junit] java.lang.NullPointerException
>     [junit]     at org.apache.lucene.search.spans.NearSpansUnordered$SpansCell.access$300(NearSpansUnordered.java:65)
>     [junit]     at org.apache.lucene.search.spans.NearSpansUnordered.isPayloadAvailable(NearSpansUnordered.java:235)
>     [junit]     at org.apache.lucene.search.spans.NearSpansOrdered.shrinkToAfterShortestMatch(NearSpansOrdered.java:246)
>     [junit]     at org.apache.lucene.search.spans.NearSpansOrdered.advanceAfterOrdered(NearSpansOrdered.java:154)
>     [junit]     at org.apache.lucene.search.spans.NearSpansOrdered.next(NearSpansOrdered.java:122)
>     [junit]     at org.apache.lucene.search.spans.SpanScorer.next(SpanScorer.java:54)
>     [junit]     at org.apache.lucene.search.Scorer.score(Scorer.java:57)
>     [junit]     at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:137)
>     [junit]     at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:113)
>     [junit]     at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:113)
>     [junit]     at org.apache.lucene.search.Hits.<init>(Hits.java:80)
>     [junit]     at org.apache.lucene.search.Searcher.search(Searcher.java:50)
>     [junit]     at org.apache.lucene.search.Searcher.search(Searcher.java:40)
>     [junit]     at com.attivio.lucene.SpanQueryTest.search(SpanQueryTest.java:79)
>     [junit]     at com.attivio.lucene.SpanQueryTest.assertHitCount(SpanQueryTest.java:75)
>     [junit]     at com.attivio.lucene.SpanQueryTest.test(SpanQueryTest.java:67)
> {code}
> will attach unit test that causes exception (and passes with updated isPayloadAvailable())

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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