sodonnel commented on code in PR #5294:
URL: https://github.com/apache/ozone/pull/5294#discussion_r1326996193
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/OzoneQuota.java:
##########
@@ -218,12 +218,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.");
Review Comment:
I don't know. What is a "long" to someone who is not a programmer? Most
people know what an "integer" is, but a long is a programmer term and not well
understood, hence my suggestion to change it to integer for the purposes of an
error message. "Number" would have been better, but that does not run out
decimal points etc.
--
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]