You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Mark Miller (JIRA)" <ji...@apache.org> on 2009/03/04 15:19:56 UTC

[jira] Resolved: (LUCENE-689) NullPointerException thrown by equals method in SpanOrQuery

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

Mark Miller resolved LUCENE-689.
--------------------------------

    Resolution: Fixed

thanks all

> NullPointerException thrown by equals method in SpanOrQuery
> -----------------------------------------------------------
>
>                 Key: LUCENE-689
>                 URL: https://issues.apache.org/jira/browse/LUCENE-689
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>    Affects Versions: 2.1
>         Environment: Java 1.5.0_09, RHEL 3 Linux, Tomcat 5.0.28
>            Reporter: Michael Goddard
>            Assignee: Otis Gospodnetic
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-689.txt
>
>
> Part of our code utilizes the equals method in SpanOrQuery and, in certain cases (details to follow, if necessary), a NullPointerException gets thrown as a result of the String "field" being null.  After applying the following patch, the problem disappeared:
> Index: src/java/org/apache/lucene/search/spans/SpanOrQuery.java
> ===================================================================
> --- src/java/org/apache/lucene/search/spans/SpanOrQuery.java    (revision 465065)
> +++ src/java/org/apache/lucene/search/spans/SpanOrQuery.java    (working copy)
> @@ -121,7 +121,8 @@
>      final SpanOrQuery that = (SpanOrQuery) o;
>      if (!clauses.equals(that.clauses)) return false;
> -    if (!field.equals(that.field)) return false;
> +    if (field != null && !field.equals(that.field)) return false;
> +    if (field == null && that.field != null) return false;
>      return getBoost() == that.getBoost();
>    }

-- 
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