belugabehr commented on a change in pull request #912: HBASE-23380: General 
Cleanup of FSUtil
URL: https://github.com/apache/hbase/pull/912#discussion_r357273734
 
 

 ##########
 File path: hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
 ##########
 @@ -138,20 +137,26 @@ public static boolean isDistributedFileSystem(final 
FileSystem fs) throws IOExce
    * @return True if <code>pathTail</code> is tail on the path of 
<code>pathToSearch</code>
    */
   public static boolean isMatchingTail(final Path pathToSearch, final Path 
pathTail) {
-    if (pathToSearch.depth() != pathTail.depth()) return false;
     Path tailPath = pathTail;
     String tailName;
     Path toSearch = pathToSearch;
     String toSearchName;
     boolean result = false;
+
+    if (pathToSearch.depth() != pathTail.depth()) {
+      return false;
+    }
+
     do {
       tailName = tailPath.getName();
-      if (tailName == null || tailName.length() <= 0) {
 
 Review comment:
   I ran 'blame' on `Path#getName()` and it says the following code has been 
there for 11 years now:
   
   ```
     public String getName() {
       String path = uri.getPath();
       int slash = path.lastIndexOf(SEPARATOR);
       return path.substring(slash+1);
     }
   ```

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


With regards,
Apache Git Services

Reply via email to