mirror of https://github.com/apache/lucene.git
better error msg than NPE when collection cannot be found
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1238697 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0d8d2f48e4
commit
f733000e0f
|
@ -26,6 +26,7 @@ import org.apache.solr.client.solrj.util.ClientUtils;
|
|||
import org.apache.solr.cloud.CloudDescriptor;
|
||||
import org.apache.solr.cloud.ZkController;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrException.ErrorCode;
|
||||
import org.apache.solr.common.cloud.CloudState;
|
||||
import org.apache.solr.common.cloud.Slice;
|
||||
import org.apache.solr.common.cloud.ZkCoreNodeProps;
|
||||
|
@ -300,6 +301,11 @@ public class HttpShardHandler extends ShardHandler {
|
|||
// If no collections were specified, default to the collection for
|
||||
// this core.
|
||||
slices = cloudState.getSlices(cloudDescriptor.getCollectionName());
|
||||
if (slices == null) {
|
||||
throw new SolrException(ErrorCode.BAD_REQUEST,
|
||||
"Could not find collection:"
|
||||
+ cloudDescriptor.getCollectionName());
|
||||
}
|
||||
}
|
||||
|
||||
// Store the logical slices in the ResponseBuilder and create a new
|
||||
|
|
Loading…
Reference in New Issue