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



##########
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:
       If that I think it is OK to throw exception that avoid send RPC request 
to NameNode if parameter is invalid which client has checked.




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