Skip to content

Apache Lucene open-source search software

Move null check to the right spot

Shalin Shekhar Mangarca8e4be1d39f
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
index 0f01eb5b7df..01b27a163c5 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
@@ -2328,13 +2328,12 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {
ClusterStateMutator.getShardNames(shardNames, message.getStr("shards", null));
numSlices = shardNames.size();
} else {
+ if (numSlices == null ) {
+ throw new SolrException(ErrorCode.BAD_REQUEST, NUM_SLICES + " is a required param (when using CompositeId router).");
+ }
ClusterStateMutator.getShardNames(numSlices, shardNames);
}
- if (numSlices == null ) {
- throw new SolrException(ErrorCode.BAD_REQUEST, NUM_SLICES + " is a required param (when using CompositeId router).");
- }
-
int maxShardsPerNode = message.getInt(ZkStateReader.MAX_SHARDS_PER_NODE, 1);
if (repFactor <= 0) {