Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions changelog/unreleased/Yashgoswami-SOLR-18318.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.LinkedHashMap;

/** 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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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));
}
}
Loading