jolshan commented on a change in pull request #10584: URL: https://github.com/apache/kafka/pull/10584#discussion_r651044241
########## File path: core/src/main/scala/kafka/server/KafkaApis.scala ########## @@ -1142,6 +1142,19 @@ class KafkaApis(val requestChannel: RequestChannel, val metadataRequest = request.body[MetadataRequest] val requestVersion = request.header.apiVersion + // Topic IDs are not supported for versions 10 and 11. Topic names can not be null in these versions. + if (!metadataRequest.isAllTopics) { + metadataRequest.data.topics.forEach{ topic => + // If null, set to the empty string, since the response does not allow null. + if (topic.name == null) { + topic.setName("") Review comment: We can do that. It should only apply to this specific case, but it will be cleaner there. ########## File path: clients/src/main/java/org/apache/kafka/common/requests/MetadataRequest.java ########## @@ -92,6 +93,13 @@ public MetadataRequest build(short version) { if (!data.allowAutoTopicCreation() && version < 4) throw new UnsupportedVersionException("MetadataRequest versions older than 4 don't support the " + "allowAutoTopicCreation field"); + if (data.topics() != null) { + data.topics().forEach(topic -> { + if (topic.name() == null || topic.topicId() != Uuid.ZERO_UUID) + throw new UnsupportedVersionException("MetadataRequest version " + version + Review comment: sure -- 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