You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Bruce Ritchie (JIRA)" <ji...@apache.org> on 2008/05/08 06:26:55 UTC

[jira] Created: (LUCENE-1280) NPE in PhraseQuery.toString(String f)

NPE in PhraseQuery.toString(String f)
-------------------------------------

                 Key: LUCENE-1280
                 URL: https://issues.apache.org/jira/browse/LUCENE-1280
             Project: Lucene - Java
          Issue Type: Bug
          Components: Search
    Affects Versions: 2.3.2
            Reporter: Bruce Ritchie
             Fix For: 2.4


the section

public String toString(String f) {
    StringBuffer buffer = new StringBuffer();
    if (!field.equals(f)) {
      buffer.append(field);
      buffer.append(":");
    }
    <snip>


should be

public String toString(String f) {
    StringBuffer buffer = new StringBuffer();
    if (field != null && !field.equals(f)) {
      buffer.append(field);
      buffer.append(":");
    }
    <snip>


The issue arises if a phrase query is created, no terms are added, then the phrase query is added to a boolean query. Calling toString on the boolean query will result in a NPE insdie of the PhraseQuery.


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


[jira] Resolved: (LUCENE-1280) NPE in PhraseQuery.toString(String f)

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-1280.
----------------------------------------

       Resolution: Fixed
    Lucene Fields: [New, Patch Available]  (was: [Patch Available, New])

I just committed this.  Thanks Bruce!

> NPE in PhraseQuery.toString(String f)
> -------------------------------------
>
>                 Key: LUCENE-1280
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1280
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>    Affects Versions: 2.3.2
>            Reporter: Bruce Ritchie
>             Fix For: 2.4
>
>
> the section
> public String toString(String f) {
>     StringBuffer buffer = new StringBuffer();
>     if (!field.equals(f)) {
>       buffer.append(field);
>       buffer.append(":");
>     }
>     <snip>
> should be
> public String toString(String f) {
>     StringBuffer buffer = new StringBuffer();
>     if (field != null && !field.equals(f)) {
>       buffer.append(field);
>       buffer.append(":");
>     }
>     <snip>
> The issue arises if a phrase query is created, no terms are added, then the phrase query is added to a boolean query. Calling toString on the boolean query will result in a NPE insdie of the PhraseQuery.

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