jolshan commented on a change in pull request #10584: URL: https://github.com/apache/kafka/pull/10584#discussion_r651337637
########## File path: clients/src/main/java/org/apache/kafka/common/requests/MetadataRequest.java ########## @@ -117,13 +128,21 @@ public MetadataRequestData data() { public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) { Errors error = Errors.forException(e); MetadataResponseData responseData = new MetadataResponseData(); - if (topics() != null) { - for (String topic : topics()) + if (data.topics() != null) { + for (MetadataRequestTopic topic : data.topics()) { + String topicName; + // If null, set to the empty string, since the response does not allow null. + if (topic.name() == null) + topicName = ""; + else + topicName = topic.name(); responseData.topics().add(new MetadataResponseData.MetadataResponseTopic() - .setName(topic) - .setErrorCode(error.code()) - .setIsInternal(false) - .setPartitions(Collections.emptyList())); + .setName(topicName) + .setTopicId(topic.topicId()) + .setErrorCode(error.code()) + .setIsInternal(false) + .setPartitions(Collections.emptyList())); Review comment: No. My IDE did that. I will revert that. -- 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