[
https://issues.apache.org/jira/browse/SOLR-4614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13606465#comment-13606465
]
Anshum Gupta commented on SOLR-4614:
------------------------------------
Personally, I prefer not returning null. That'd not force the callers to check
for null after every call.
> ClusterState#getSlices returns null causing NPE in ClientUtils#addSlices
> ------------------------------------------------------------------------
>
> Key: SOLR-4614
> URL: https://issues.apache.org/jira/browse/SOLR-4614
> Project: Solr
> Issue Type: Bug
> Components: clients - java, SolrCloud
> Affects Versions: 4.1
> Reporter: David Arthur
> Priority: Minor
>
> When my program sends an UpdateRequest to a collection that has been deleted,
> I am getting a NPE
> {code}
> java.lang.NullPointerException
> at
> org.apache.solr.client.solrj.util.ClientUtils.addSlices(ClientUtils.java:273)
> at
> org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:214)
> at
> org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
> {code}
> This appears to be caused by the fact that ClusterState#getSlices is
> returning null instead of an empty collection.
> ClusterState returning null:
> https://github.com/apache/lucene-solr/blob/lucene_solr_4_1/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java#L123
> ClientUtil#addSlices iterating over a null:
> https://github.com/apache/lucene-solr/blob/lucene_solr_4_1/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java#L273
> I would attach a patch, but I'm not sure what the preferred style is within
> the project (empty collection vs null checks).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]