Apache Solr open-source search software
SOLR-4752: There are some minor bugs in the Collections API parameter validation.
Mark Robert Miller03a855bac2cc
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 6a16b3a8f9f..7a6634132d0 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -72,6 +72,9 @@ Bug Fixesnot also a dynamic field triggers error message 'undefined field: "(glob)"'.(Adam Hahn, hossman, Steve Rowe)+* SOLR-4752: There are some minor bugs in the Collections API parameter+ validation. (Mark Miller)+Other Changes----------------------diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.javaindex 3e21f82561b..0a24457f91b 100644--- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java@@ -592,7 +592,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {Integer numSlices = msgStrToInt(message, NUM_SLICES, null);if (numSlices == null) {- throw new SolrException(ErrorCode.BAD_REQUEST, "collection already exists: " + collectionName);+ throw new SolrException(ErrorCode.BAD_REQUEST, NUM_SLICES + " is a required param");}int maxShardsPerNode = msgStrToInt(message, MAX_SHARDS_PER_NODE, 1);@@ -600,7 +600,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {List<String> createNodeList = ((createNodeSetStr = message.getStr(CREATE_NODE_SET)) == null)?null:StrUtils.splitSmart(createNodeSetStr, ",", true);if (repFactor <= 0) {- throw new SolrException(ErrorCode.BAD_REQUEST, NUM_SLICES + " is a required paramater");+ throw new SolrException(ErrorCode.BAD_REQUEST, REPLICATION_FACTOR + " must be greater than or equal to 0");}if (numSlices <= 0) {@@ -781,7 +781,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {}}- private int msgStrToInt(ZkNodeProps message, String key, Integer def)+ private Integer msgStrToInt(ZkNodeProps message, String key, Integer def)throws Exception {String str = message.getStr(key);try {