ayushtkn commented on code in PR #4896:
URL: https://github.com/apache/ozone/pull/4896#discussion_r1230071761
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -1348,14 +1348,16 @@ public List<SCMCommand> getCommandQueue(UUID dnID) {
*/
@Override
public DatanodeDetails getNodeByUuid(String uuid) {
- if (Strings.isNullOrEmpty(uuid)) {
- LOG.warn("uuid is null");
- return null;
- }
- DatanodeDetails temp = DatanodeDetails.newBuilder()
- .setUuid(UUID.fromString(uuid)).build();
+ return uuid != null && !uuid.isEmpty()
+ ? getNodeByUuid(UUID.fromString(uuid))
+ : null;
+ }
+
+ @Override
+ public DatanodeDetails getNodeByUuid(UUID uuid) {
try {
- return nodeStateManager.getNode(temp);
+ return nodeStateManager.getNode(
+ DatanodeDetails.newBuilder().setUuid(uuid).build());
Review Comment:
earlier if ``uuid`` was ``null`` it would have returned ``null``, I think
now it will throw an exception when we call ``build``
```
Preconditions.checkNotNull(id);
```
Should we maintain the old behaviour and let it return ``null`` only, rather
than the exception, in case of ``getNodeByUuid(String uuid)`` we are returning
``null`` when ``uuid`` is ``null``
--
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]