lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruce Ritchie (JIRA)" <j...@apache.org>
Subject [jira] Created: (LUCENE-1280) NPE in PhraseQuery.toString(String f)
Date Thu, 08 May 2008 04:26:55 GMT
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


Mime
View raw message