dajac commented on a change in pull request #10141:
URL: https://github.com/apache/kafka/pull/10141#discussion_r586194412



##########
File path: core/src/main/scala/kafka/admin/ReassignPartitionsCommand.scala
##########
@@ -812,6 +812,26 @@ object ReassignPartitionsCommand extends Logging {
     proposedAssignments
   }
 
+  private def describeTopics(adminClient: Admin,
+                             topics: Set[String])
+                             : Map[String, TopicDescription] = {
+    adminClient.describeTopics(topics.asJava).values.asScala.map {
+      case (topicName, topicDescriptionFuture) =>
+        try {
+          topicName -> topicDescriptionFuture.get
+        }
+        catch {
+          case t: ExecutionException =>
+            if 
(classOf[UnknownTopicOrPartitionException].isInstance(t.getCause)) {

Review comment:
       I initially used `t.getCause != null && 
t.getCause.isInstanceOf[UnknownTopicOrPartitionException]`. @chia7712 suggested 
to use `classOf[UnknownTopicOrPartitionException].isInstance(t.getCause)` to 
avoid having to do the null check as `isInstance` does it. That seemed 
reasonable to me so I went with it. Is there a reason not to use it?
   
   I do agree with your second comment.




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


Reply via email to