anuengineer commented on a change in pull request #293: HDDS-2530. Sonar :
refactor verifyResourceName in HddsClientUtils to fix Sonar errors
URL: https://github.com/apache/hadoop-ozone/pull/293#discussion_r354461524
##########
File path:
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
##########
@@ -150,6 +142,49 @@ public static void verifyResourceName(String resName)
throw new IllegalArgumentException("Bucket or Volume name "
+ "cannot end with a period or dash");
}
+ }
+
+ private static boolean isLowercaseAlphanumeric(char c) {
+ return (Character.toString(c).matches("[a-z0-9]"));
Review comment:
Unless Java inlines the isLower or isDigit, from the performance point of
view, I bet that checking if (char < a || char > 9) is way more faster. If
someone can profile and it prove that I am wrong, I would be very happy to
learn how Java works. But from a gut perspective I think this is actually
slower -- but then again, it really does not matter, and if it improves code
reading I am all for it. Just commenting here for posterity's sake; so that
someone profiles this and tells us the perf argument did not hold.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]