showuon commented on code in PR #11438:
URL: https://github.com/apache/kafka/pull/11438#discussion_r858349721


##########
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##########
@@ -853,15 +853,21 @@ public static void delete(final File rootFile) throws 
IOException {
         Files.walkFileTree(rootFile.toPath(), new SimpleFileVisitor<Path>() {
             @Override
             public FileVisitResult visitFileFailed(Path path, IOException exc) 
throws IOException {
-                // If the root path did not exist, ignore the error; otherwise 
throw it.
-                if (exc instanceof NoSuchFileException && 
path.toFile().equals(rootFile))
-                    return FileVisitResult.TERMINATE;
+                if (exc instanceof NoSuchFileException) {
+                    if (path.toFile().equals(rootFile)) {
+                        // If the root path did not exist, ignore the error 
and terminate;
+                        return FileVisitResult.TERMINATE;
+                    } else {
+                        //  Otherwise, just continue walking because we don't 
have to delete this file.

Review Comment:
   nit: additional space after //
   Also, could we mention that the file might already be deleted by other 
threads?



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to