[
https://issues.apache.org/jira/browse/KAFKA-13752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17508255#comment-17508255
]
Justine Olshan commented on KAFKA-13752:
----------------------------------------
Ah, so I think the line that is causing an issue is:
```
if (topic.topicId() != Uuid.ZERO_UUID && version < 12)
throw new UnsupportedVersionException("MetadataRequest version " + version +
" does not support non-zero topic IDs.");
```
We should change this to !equals.
> Using `equals` instead of `==` when Uuid compare in Java
> --------------------------------------------------------
>
> Key: KAFKA-13752
> URL: https://issues.apache.org/jira/browse/KAFKA-13752
> Project: Kafka
> Issue Type: Improvement
> Components: clients
> Reporter: Xiaobing Fang
> Priority: Minor
>
> {code:java}
> Uuid.ZERO_UUID == new Uuid(0L, 0L){code}
> is true in scala, but in java is false.
>
> So this test run sccessfully. Is this the expected situation??
> {code:java}
> @Test
> public void testTopicIdAndNullTopicNameRequests() {
> // Construct invalid MetadataRequestTopics. We will build each one
> separately and ensure the error is thrown.
> List<MetadataRequestData.MetadataRequestTopic> topics = Arrays.asList(
> new
> MetadataRequestData.MetadataRequestTopic().setName("topic").setTopicId(new
> Uuid(0L, 0L)));
> // if version is 10 or 11, the invalid topic metadata should return an
> error
> List<Short> invalidVersions = Arrays.asList((short) 10, (short) 11);
> invalidVersions.forEach(version ->
> topics.forEach(topic -> {
> MetadataRequestData metadataRequestData = new
> MetadataRequestData().setTopics(Collections.singletonList(topic));
> MetadataRequest.Builder builder = new
> MetadataRequest.Builder(metadataRequestData);
> assertThrows(UnsupportedVersionException.class, () ->
> builder.build(version));
> })
> );
> }{code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)