dombizita commented on code in PR #4478:
URL: https://github.com/apache/ozone/pull/4478#discussion_r1152071974


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OFSPath.java:
##########
@@ -163,6 +163,14 @@ public String getKeyName() {
     return keyName;
   }
 
+  /**
+   * Returns the last element of the KeyName, which can either be a file name
+   * or the leaf directory/bucket.
+   */
+  public String getFileName() {
+    return keyName.substring(keyName.lastIndexOf(OZONE_URI_DELIMITER) + 1);

Review Comment:
   thanks @sadanand48, this is a better way to check it, my approach was even 
not correct in the case of a path like `/vol1/bucket1/dir1/` as it returned 
empty. I updated my patch accordingly and also adjusted the tests.



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