Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-13404: Fix NPE when group=true and no group.field is present

Munendra S N48b026d5eedc
diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
index 5f7b218e1a3..4461f1fc8c1 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
@@ -286,10 +286,13 @@ public class QueryComponent extends SearchComponent
if (req.getCore().getCoreContainer().isZooKeeperAware()) {
IndexSchema schema = rb.req.getSchema();
String[] fields = params.getParams(GroupParams.GROUP_FIELD);
- for (String field : fields) {
- SchemaField schemaField = schema.getField(field);
- if (schemaField.getType().isTokenized() && (schemaField.getType() instanceof SortableTextField) == false) {
- throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, String.format(Locale.ROOT, "Sorting on a tokenized field that is not a SortableTextField is not supported in cloud mode."));
+ if (fields != null) {
+ for (String field : fields) {
+ SchemaField schemaField = schema.getField(field);
+ if (schemaField.getType().isTokenized() && (schemaField.getType() instanceof SortableTextField) == false) {
+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, String.format(Locale.ROOT,
+ "Sorting on a tokenized field that is not a SortableTextField is not supported in cloud mode."));
+ }
}
}
}