epugh commented on code in PR #4661:
URL: https://github.com/apache/solr/pull/4661#discussion_r3675874589
##########
solr/api/src/java/org/apache/solr/client/api/model/NodeSystemResponse.java:
##########
@@ -23,13 +23,14 @@
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;
+ public Map<String, Object> remoteNodeData= new LinkedHashMap<>();
Review Comment:
Since this PR fixes the NPE by initializing `remoteNodeData`, could we
resolve the open `TODO` here rather than leave it dangling? The typing question
already has an answer: proxied responses stored here are indeed
`NodeSystemResponse`, but this map is also populated dynamically via
`@JsonAnySetter` below, where Jackson hands back plain `Object` values.
Tightening the type would mean reworking that `@JsonAnySetter` handling and
could affect this response's JSON (de)serialization — out of scope for an NPE
fix. Suggest swapping the `TODO` for a note explaining why `Object` stays:
```suggestion
// Object, not NodeSystemResponse, since @JsonAnySetter below also feeds
this map raw values.
public Map<String, Object> remoteNodeData = new LinkedHashMap<>();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]