You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2026/08/02 20:55:18 UTC
(solr) 02/13: SOLR-18318: Fix NPE in GetNodeSystemInfo when nodes param is set (#4661)
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit 2f62b8085d8752c8d65f03027dee378fe4d55067
Author: Yash Goswami <yg...@outlook.com>
AuthorDate: Wed Jul 29 21:19:50 2026 +0530
SOLR-18318: Fix NPE in GetNodeSystemInfo when nodes param is set (#4661)
(cherry picked from commit 84098343b6eccd6347941393e239a656ffa68a03)
---
changelog/unreleased/Yashgoswami-SOLR-18318.yml | 10 +++++
.../solr/client/api/model/NodeSystemResponse.java | 6 +--
.../admin/api/GetNodeSystemInfoSolrCloudTest.java | 48 ++++++++++++++++++++++
3 files changed, 61 insertions(+), 3 deletions(-)
diff --git a/changelog/unreleased/Yashgoswami-SOLR-18318.yml b/changelog/unreleased/Yashgoswami-SOLR-18318.yml
new file mode 100644
index 00000000000..030b8c9e6ba
--- /dev/null
+++ b/changelog/unreleased/Yashgoswami-SOLR-18318.yml
@@ -0,0 +1,10 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+
+title: >
+ Fix NullPointerException in GetNodeSystemInfo when the nodes parameter is provided in SolrCloud mode
+type: fixed
+authors:
+ - name: Yash Goswami
+links:
+ - name: SOLR-18318
+ url: https://issues.apache.org/jira/browse/SOLR-18318
diff --git a/solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.java
index 1971e323dcd..f513ca46b0d 100644
--- a/solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.java
+++ b/solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.java
@@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -27,9 +28,8 @@ import java.util.Set;
/** Response from /node/system */
public class NodeSystemResponse extends SolrJerseyResponse {
- // TODO The typing here is kindof wonky - can I tighten 'Object' here to be NodeSystemResponse or
- // will Jackson choke on that?
- public Map<String, Object> remoteNodeData;
+ // Object, not NodeSystemResponse, since @JsonAnySetter below also feeds this map raw values.
+ public Map<String, Object> remoteNodeData = new LinkedHashMap<>();
@JsonAnyGetter
public Map<String, Object> remoteNodeData() {
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/GetNodeSystemInfoSolrCloudTest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/GetNodeSystemInfoSolrCloudTest.java
new file mode 100644
index 00000000000..12a6b7e9c06
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/GetNodeSystemInfoSolrCloudTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.SystemApi;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class GetNodeSystemInfoSolrCloudTest extends SolrCloudTestCase {
+
+ @BeforeClass
+ public static void setupCluster() throws Exception {
+ configureCluster(1).addConfig("conf", configset("cloud-minimal")).configure();
+ CollectionAdminRequest.createCollection(DEFAULT_TEST_COLLECTION_NAME, "conf", 1, 1)
+ .process(cluster.getSolrClient());
+ }
+
+ @Test
+ public void testGetNodeInfoWithNodesParam() throws Exception {
+ String nodeName =
+ cluster.getJettySolrRunners().get(0).getCoreContainer().getZkController().getNodeName();
+
+ final var req = new SystemApi.GetNodeSystemInfo();
+ req.setNodes(nodeName);
+
+ final var infoRsp = req.process(cluster.getSolrClient());
+
+ assertEquals(0, infoRsp.responseHeader.status);
+ assertNotNull(infoRsp.remoteNodeData);
+ assertTrue(infoRsp.remoteNodeData.containsKey(nodeName));
+ }
+}