dlmarion commented on code in PR #5450:
URL: https://github.com/apache/accumulo/pull/5450#discussion_r2027493727


##########
server/manager/src/main/java/org/apache/accumulo/manager/state/SetGoalState.java:
##########
@@ -36,7 +36,15 @@ public class SetGoalState {
    * Utility program that will change the goal state for the manager from the 
command line.
    */
   public static void main(String[] args) throws Exception {
-    if (args.length != 1 || ManagerGoalState.valueOf(args[0]) == null) {
+    if (args.length != 1) {
+      System.err.println(
+          "Usage: accumulo " + SetGoalState.class.getName() + " 
[NORMAL|SAFE_MODE|CLEAN_STOP]");
+      System.exit(-1);
+    }
+
+    try {
+      ManagerGoalState.valueOf(args[0]);

Review Comment:
   updated errorprone flagged this is an impossible null check because 
Enum.valueOf does not return null, it throws an IllegalArgumentException.



##########
minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java:
##########
@@ -150,7 +149,7 @@ public void adminStopAll() throws IOException {
    */
   public void setGoalState(String goalState) throws IOException {
     requireNonNull(goalState, "Goal state must not be null");
-    checkArgument(ManagerGoalState.valueOf(goalState) != null, "Unknown goal 
state: " + goalState);
+    ManagerGoalState.valueOf(goalState);

Review Comment:
   updated errorprone flagged this is an impossible null check because 
Enum.valueOf does not return null, it throws an IllegalArgumentException.



-- 
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