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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to