cadonna commented on code in PR #18069:
URL: https://github.com/apache/kafka/pull/18069#discussion_r1872802293
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java:
##########
@@ -360,6 +368,27 @@ public void testStreamsRequestValidation() {
.setRackId("")));
assertEquals("RackId can't be empty.", ex.getMessage());
+ // InstanceId can't be null with static membership
+ ex = assertThrows(InvalidRequestException.class, () ->
context.streamsGroupHeartbeat(
+ new StreamsGroupHeartbeatRequestData()
+ .setGroupId("foo")
+ .setMemberId(memberId)
+ .setMemberEpoch(LEAVE_GROUP_STATIC_MEMBER_EPOCH)
+ .setInstanceId(null)
+ .setRackId("rackid")));
+ assertEquals("InstanceId can't be null.", ex.getMessage());
+
+ // With non-static membership, the memberEpoch must be -1 or greater
Review Comment:
This comment is a bit misleading because this verification verifies that the
member epoch is greater or equal -2 no matter whether static membership is used
or not.
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -1599,6 +1599,25 @@ private void throwIfNull(
}
}
+
+
+ /**
+ * Throws an InvalidRequestException if the value is null or empty.
+ *
+ * @param value The value.
+ * @param error The error message.
+ * @throws InvalidRequestException
+ */
+ private void throwIfNullOrEmpty(
+ String value,
+ String error
+ ) throws InvalidRequestException {
+ if (value == null || value.trim().isEmpty()) {
+ throw new InvalidRequestException(error);
+ }
+ }
+
+
Review Comment:
nit:
```suggestion
```
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -1599,6 +1599,25 @@ private void throwIfNull(
}
}
+
+
Review Comment:
nit:
```suggestion
```
--
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]