jolshan commented on code in PR #12850:
URL: https://github.com/apache/kafka/pull/12850#discussion_r1028558389


##########
clients/src/main/java/org/apache/kafka/common/requests/LeaveGroupResponse.java:
##########
@@ -55,6 +56,22 @@ public LeaveGroupResponse(LeaveGroupResponseData data) {
         this.data = data;
     }
 
+    public LeaveGroupResponse(LeaveGroupResponseData data, short version) {
+        super(ApiKeys.LEAVE_GROUP);
+
+        if (version >= 3) {
+            this.data = data;
+        } else {
+            if (data.members().size() != 1) {
+                throw new UnsupportedVersionException("LeaveGroup response 
version " + version +
+                    " can only contain one member, got " + 
data.members().size() + " members.");
+            }
+
+            this.data = new LeaveGroupResponseData()

Review Comment:
   This seems to be normalizing the response? Seems like we just need to set 
the error code, but its done in a way that's a little confusing. Why do we need 
to getError when we have the data.errorCode?
   
   Is it because it can be the top level error OR the single member error?



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to