lucasbru commented on code in PR #23571:
URL: https://github.com/apache/kafka/pull/23571#discussion_r4130808818


##########
clients/src/testFixtures/java/org/apache/kafka/test/faultproxy/KafkaProtocolFaultProxy.java:
##########
@@ -417,8 +417,13 @@ private void applyRouting(final AbstractResponse response) 
{
             ((MetadataResponse) response).data().brokers().forEach(b -> 
b.setHost(proxyHost).setPort(proxyPort));
         } else if (response instanceof FindCoordinatorResponse) {
             final FindCoordinatorResponse fc = (FindCoordinatorResponse) 
response;
-            fc.data().setHost(proxyHost).setPort(proxyPort);
-            fc.data().coordinators().forEach(c -> 
c.setHost(proxyHost).setPort(proxyPort));
+            // v0-3 carry a single top-level host/port and v4+ only the 
coordinators list; setting the
+            // top-level fields on a v4+ response makes re-serialization fail 
and the frame go out unrewritten
+            if (fc.data().coordinators().isEmpty()) {
+                fc.data().setHost(proxyHost).setPort(proxyPort);
+            } else {
+                fc.data().coordinators().forEach(c -> 
c.setHost(proxyHost).setPort(proxyPort));

Review Comment:
   That looks valid



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to