This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch 2.8
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/2.8 by this push:
new 07e2b56 KAFKA-12321 the comparison function for uuid type should be
'equals' rather than '==' (#10098)
07e2b56 is described below
commit 07e2b561f9e953adb941654cdfa8e67f7f099abd
Author: Chia-Ping Tsai <[email protected]>
AuthorDate: Sat Feb 13 00:07:19 2021 +0800
KAFKA-12321 the comparison function for uuid type should be 'equals' rather
than '==' (#10098)
Reviewers: Ismael Juma <[email protected]>
---
.../test/java/org/apache/kafka/common/message/MessageTest.java | 8 ++++++++
generator/src/main/java/org/apache/kafka/message/FieldSpec.java | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git
a/clients/src/test/java/org/apache/kafka/common/message/MessageTest.java
b/clients/src/test/java/org/apache/kafka/common/message/MessageTest.java
index 52cd338..5dc379e 100644
--- a/clients/src/test/java/org/apache/kafka/common/message/MessageTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/message/MessageTest.java
@@ -49,6 +49,7 @@ import org.apache.kafka.common.protocol.ApiKeys;
import org.apache.kafka.common.protocol.ByteBufferAccessor;
import org.apache.kafka.common.protocol.Errors;
import org.apache.kafka.common.protocol.Message;
+import org.apache.kafka.common.protocol.MessageUtil;
import org.apache.kafka.common.protocol.ObjectSerializationCache;
import org.apache.kafka.common.protocol.types.RawTaggedField;
import org.junit.jupiter.api.Test;
@@ -750,6 +751,13 @@ public final class MessageTest {
}
@Test
+ public void defaultValueShouldBeWritable() {
+ for (short version =
SimpleExampleMessageData.LOWEST_SUPPORTED_VERSION; version <=
SimpleExampleMessageData.HIGHEST_SUPPORTED_VERSION; ++version) {
+ MessageUtil.toByteBuffer(new SimpleExampleMessageData(), version);
+ }
+ }
+
+ @Test
public void testSimpleMessage() throws Exception {
final SimpleExampleMessageData message = new
SimpleExampleMessageData();
message.setMyStruct(new
SimpleExampleMessageData.MyStruct().setStructId(25).setArrayInStruct(
diff --git a/generator/src/main/java/org/apache/kafka/message/FieldSpec.java
b/generator/src/main/java/org/apache/kafka/message/FieldSpec.java
index 0f31ba0..d15b03c 100644
--- a/generator/src/main/java/org/apache/kafka/message/FieldSpec.java
+++ b/generator/src/main/java/org/apache/kafka/message/FieldSpec.java
@@ -589,7 +589,7 @@ public final class FieldSpec {
fieldPrefix, camelCaseName(), fieldPrefix,
camelCaseName());
}
}
- } else if (type().isString() || type().isStruct()) {
+ } else if (type().isString() || type().isStruct() || type() instanceof
FieldType.UUIDFieldType) {
if (fieldDefault.equals("null")) {
buffer.printf("if (%s%s != null) {%n", fieldPrefix,
camelCaseName());
} else if (nullableVersions.empty()) {