DaveTeng0 commented on code in PR #3672:
URL: https://github.com/apache/ozone/pull/3672#discussion_r954073951


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/ReplicationOptions.java:
##########
@@ -81,7 +81,21 @@ public void setReplication(String replication) {
   }
 
   // Option is defined in subclasses
-  public void setType(ReplicationType type) {
-    this.type = type;
+  public void setType(String type) {
+    try {
+      ReplicationType replicationType = ReplicationType.valueOf(type);
+      if (replicationType == ReplicationType.CHAINED
+              || replicationType == ReplicationType.STAND_ALONE) {
+        throw new IllegalArgumentException(
+                String.format("Unsupported replication type %s",
+                        replicationType.name()));
+      }
+      this.type = replicationType;
+    } catch (IllegalArgumentException ex) {
+      throw new IllegalArgumentException(
+              String.format("Invalid value '%s' for option '--type'. %s." +
+                      " Supported values are: RATIS, EC.",
+                      type, ex.getMessage()));
+    }

Review Comment:
   Agree! thanks Attila!!



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

Reply via email to