ayushtkn commented on code in PR #5477:
URL: https://github.com/apache/hadoop/pull/5477#discussion_r1144296150


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java:
##########
@@ -2413,8 +2413,13 @@ private void handleFileStat(LocatedFileStatus stat) 
throws IOException {
         if (stat.isFile()) { // file
           curFile = stat;
         } else if (recursive) { // directory
-          itors.push(curItor);
-          curItor = listLocatedStatus(stat.getPath());
+          try {
+            RemoteIterator<LocatedFileStatus> newDirItor = 
listLocatedStatus(stat.getPath());

Review Comment:
   That wasn't an issue. If you do ``listLocatedStatus(stat.getPath());`` and 
the path is a file, it will still return an iterator with just one entry which 
is that file, and it will again loop on that iterator find the first entry as 
file and add it to the list, So, that won't break but I have added a mocked 
test as well for this case.



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