You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/06/12 00:44:56 UTC

[GitHub] [hadoop-ozone] xiaoyuyao commented on a change in pull request #1044: HDDS-3743. Avoid NetUtils#normalize when get DatanodeDetails from proto

xiaoyuyao commented on a change in pull request #1044:
URL: https://github.com/apache/hadoop-ozone/pull/1044#discussion_r439149023



##########
File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/net/NetUtils.java
##########
@@ -59,9 +64,12 @@ public static String normalize(String path) {
               + NetConstants.PATH_SEPARATOR_STR + ": " + path);
     }
 
+    if (len == 1 || path.charAt(len - 1) != NetConstants.PATH_SEPARATOR) {

Review comment:
       Can we simplified the logic without any matcher by using apache common StringUtils?
   
   return len == 1 ? path : StringUtils.removeEnd(path, "/");




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org