cmccabe commented on code in PR #13686:
URL: https://github.com/apache/kafka/pull/13686#discussion_r1187899780


##########
shell/src/main/java/org/apache/kafka/shell/command/FindCommandHandler.java:
##########
@@ -80,28 +84,28 @@ public FindCommandHandler(List<String> paths) {
     }
 
     @Override
-    public void run(Optional<InteractiveShell> shell,
-                    PrintWriter writer,
-                    MetadataNodeManager manager) throws Exception {
+    public void run(
+        Optional<InteractiveShell> shell,
+        PrintWriter writer,
+        MetadataShellState state
+    ) throws Exception {
         for (String path : CommandUtils.getEffectivePaths(paths)) {
-            manager.visit(new GlobVisitor(path, entryOption -> {
+            new GlobVisitor(path, entryOption -> {
                 if (entryOption.isPresent()) {
                     find(writer, path, entryOption.get().node());
                 } else {
                     writer.println("find: " + path + ": no such file or 
directory.");
                 }
-            }));
+            }).accept(state);
         }
     }
 
     private void find(PrintWriter writer, String path, MetadataNode node) {
         writer.println(path);
-        if (node instanceof DirectoryNode) {
-            DirectoryNode directory = (DirectoryNode) node;
-            for (Entry<String, MetadataNode> entry : 
directory.children().entrySet()) {
-                String nextPath = path.equals("/") ?
-                    path + entry.getKey() : path + "/" + entry.getKey();
-                find(writer, nextPath, entry.getValue());
+        if (node.isDirectory()) {

Review Comment:
   That would be a logic error. I will add a check and RuntimeException to make 
it clearer.



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