sodonnel commented on code in PR #5294:
URL: https://github.com/apache/ozone/pull/5294#discussion_r1329925968


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/OzoneQuota.java:
##########
@@ -218,12 +216,17 @@ public static OzoneQuota parseNameSpaceQuota(String 
quotaInNamespace) {
       throw new IllegalArgumentException(
           "Quota string cannot be null or empty.");
     }
-    long nameSpaceQuota = Long.parseLong(quotaInNamespace);
-    if (nameSpaceQuota <= 0) {
-      throw new IllegalArgumentException(
-          "Invalid values for namespace quota: " + nameSpaceQuota);
+    try {
+      long nameSpaceQuota = Long.parseLong(quotaInNamespace);
+      if (nameSpaceQuota <= 0) {
+        throw new IllegalArgumentException(
+            "Invalid value for namespace quota: " + nameSpaceQuota);
+      }
+      return new OzoneQuota(nameSpaceQuota, new RawQuotaInBytes(Units.B, -1));
+    } catch (NumberFormatException e) {
+      throw new IllegalArgumentException(quotaInNamespace + " is invalid. " +
+          "The quota value should be a positive integer between 1 and 
Long.MAX_VALUE");

Review Comment:
   I was going to suggest we should put the actual value of Long.MAX_VALUE in, 
rather than the string, but the max value is apparently 9223372036854775807, 
which isn't all that user friendly either. But it doesn't feel right that the 
error should say "between 1 and Long.MAX_VALUE". So I think that either we 
should put the very long number in, or just have it as "The quota value should 
be a positive integer number of bytes" or something like that.
   
   Sorry we keep iterating on this - its probably not even all that important, 
but as its a user facing error its good to make it explain the problem as much 
as possible.



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