zhaoyim commented on a change in pull request #2037:
URL: https://github.com/apache/hadoop/pull/2037#discussion_r449973580



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
##########
@@ -201,8 +201,19 @@ public void run(Path path) throws IOException {
       super(conf);
       CommandFormat c = new CommandFormat(2, Integer.MAX_VALUE);
       List<String> parameters = c.parse(args, pos);
-      this.quota =
-          
StringUtils.TraditionalBinaryPrefix.string2long(parameters.remove(0));
+      String str = parameters.get(0).trim();
+      try {
+        this.quota = StringUtils.TraditionalBinaryPrefix
+                .string2long(parameters.remove(0));
+      } catch(NumberFormatException e){
+        throw new IllegalArgumentException("\"" + str +
+                "\" is not a valid value for a quota.");
+      }
+      if (HdfsConstants.QUOTA_DONT_SET == this.quota) {
+        System.out.print("WARN: \"" + this.quota +

Review comment:
       Changed to ```System.err.print```.  And I agree with you, not need to 
execute the backward code, but here I confused is this message just a warning 
message, it is suitable to throw an Exception ? Any ideas? Thanks!




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

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