-
Couldn't load subscription status.
- Fork 2.3k
Closed
Labels
Description
Describe the bug
Hello.
We've analyzed Opensearch sources with SAST and it pointed out possible NPE in
OpenSearch/server/src/main/java/org/opensearch/rest/action/cat/RestTasksAction.java
Line 175 in a586a62
| table.addCell(node.getAddress().address().getPort()); |
table.addCell(fullId ? nodeId : Strings.substring(nodeId, 0, 4));
table.addCell(node == null ? "-" : node.getHostAddress());
table.addCell(node.getAddress().address().getPort());
table.addCell(node == null ? "-" : node.getName());
table.addCell(node == null ? "-" : node.getVersion().toString());
I think this code should look identical in every node access:
table.addCell(node == null ? "-" : node.getHostAddress());
table.addCell(node == null ? "-" : node.getAddress().address().getPort());
table.addCell(node == null ? "-" : node.getName());
table.addCell(node == null ? "-" : node.getVersion().toString());```
### Related component
_No response_
### To Reproduce
Didn't catch it in action, just static analysis of the code
### Expected behavior
From the comments in the code if node will left the cluster, then no metadata will be available and not even ip address of the node should be '-', but port also
### Additional Details
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done