cmccabe commented on a change in pull request #10505: URL: https://github.com/apache/kafka/pull/10505#discussion_r614264455
########## File path: core/src/main/scala/kafka/server/ControllerApis.scala ########## @@ -242,87 +253,99 @@ class ControllerApis(val requestChannel: RequestChannel, val toAuthenticate = new util.HashSet[String] toAuthenticate.addAll(providedNames) val idToName = new util.HashMap[Uuid, String] - controller.findTopicNames(providedIds).get().forEach { (id, nameOrError) => - if (nameOrError.isError) { - appendResponse(null, id, nameOrError.error()) - } else { - toAuthenticate.add(nameOrError.result()) - idToName.put(id, nameOrError.result()) - } - } - // Get the list of deletable topics (those we can delete) and the list of describeable - // topics. If a topic can't be deleted or described, we have to act like it doesn't - // exist, even when it does. - val topicsToAuthenticate = toAuthenticate.asScala - val (describeable, deletable) = if (hasClusterAuth) { - (topicsToAuthenticate.toSet, topicsToAuthenticate.toSet) - } else { - (getDescribableTopics(topicsToAuthenticate), getDeletableTopics(topicsToAuthenticate)) - } - // For each topic that was provided by ID, check if authentication failed. - // If so, remove it from the idToName map and create an error response for it. - val iterator = idToName.entrySet().iterator() - while (iterator.hasNext) { - val entry = iterator.next() - val id = entry.getKey - val name = entry.getValue - if (!deletable.contains(name)) { - if (describeable.contains(name)) { - appendResponse(name, id, new ApiError(TOPIC_AUTHORIZATION_FAILED)) + controller.findTopicNames(providedIds).thenCompose(topicNames => { Review comment: When I remove the braces I get this compiler error: ``` > Task :core:compileScala FAILED [Error] /home/cmccabe/src/kafka1/core/src/main/scala/kafka/server/ControllerApis.scala:270: ')' expected but 'val' found. [Error] /home/cmccabe/src/kafka1/core/src/main/scala/kafka/server/ControllerApis.scala:278: ';' expected but 'val' found. two errors found ``` Maybe let's follow up on this in a separate PR, if you can find a way to remove some of the braces and still have it compile... -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org