xBis7 commented on code in PR #3746:
URL: https://github.com/apache/ozone/pull/3746#discussion_r979909970


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/handlers/DirectoryEntityHandler.java:
##########
@@ -89,7 +91,15 @@ public DUResponse getDuResponse(
     for (long subdirObjectId: subdirs) {
       NSSummary subdirNSSummary =
               getReconNamespaceSummaryManager().getNSSummary(subdirObjectId);
-      String subdirName = subdirNSSummary.getDirName();
+      // for the subdirName we need the filename, not the key name
+      Path subdirPath = Paths.get(subdirNSSummary.getDirName());
+      Path subdirFileName = subdirPath.getFileName();
+      String subdirName;
+      if (subdirFileName != null) {
+        subdirName = subdirFileName.toString();
+      } else {
+        throw new NullPointerException("Subdirectory file name is null.");
+      }

Review Comment:
   My mistake, I updated the comment to be more descriptive of the issue. Eg. 
the key name is `dir1/dir2`, then we just need to add the subdir to the path, 
we need `dir2`. Otherwise, we will end up having `dir1` twice while this is an 
iterative process going over all directories and adding them one by one.



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