adoroszlai commented on code in PR #1292:
URL: https://github.com/apache/ratis/pull/1292#discussion_r2386125222


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java:
##########
@@ -170,8 +170,8 @@ public static RaftServerProxy newRaftServer(
       RaftPeerId id, RaftGroup group, RaftStorage.StartupOption option, 
StateMachine.Registry stateMachineRegistry,
       ThreadGroup threadGroup, RaftProperties properties, Parameters 
parameters) throws IOException {
     RaftServer.LOG.debug("newRaftServer: {}, {}", id, group);
+    Objects.requireNonNull(id, "id == null");
     if (group != null && !group.getPeers().isEmpty()) {
-      Objects.requireNonNull(id, () -> "RaftPeerId " + id + " is not in 
RaftGroup " + group);
       Objects.requireNonNull(group.getPeer(id), () -> "RaftPeerId " + id + " 
is not in RaftGroup " + group);

Review Comment:
   This is useless.
   
   1. If `id == null` line 173 throws, so it cannot be null in line 175.
   2. `+ id` and `+ String.valueOf(id)` results in the same string even if `id 
== 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]

Reply via email to