You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Chris Male (JIRA)" <ji...@apache.org> on 2011/07/08 05:04:18 UTC

[jira] [Updated] (SOLR-2027) SolrJ FacetField should never return null from getValues()

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

Chris Male updated SOLR-2027:
-----------------------------

    Attachment: SOLR-2027.patch

Patch which fixes the problem and adds a trivial test to prevent regression.

Ready to go.

> SolrJ FacetField should never return null from getValues()
> ----------------------------------------------------------
>
>                 Key: SOLR-2027
>                 URL: https://issues.apache.org/jira/browse/SOLR-2027
>             Project: Solr
>          Issue Type: Improvement
>          Components: clients - java
>    Affects Versions: 1.4.1
>            Reporter: David Smiley
>            Assignee: Chris Male
>            Priority: Minor
>         Attachments: SOLR-2027.patch
>
>
> In some circumstances, FacetField.getValues() will return null.  I'd like for my iteration code to simply be:
> {code:java}
> for (c : ff.getValues() { 
>   // ...
> }
> {code}
> However this will throw an NPE if I don't wrap this in either a null check or this check: ff.getValueCount() > 0
> I propose that getValues() return a Collections.EMPTY_LIST if the internal value is null.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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