You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ch...@apache.org on 2021/02/12 17:16:41 UTC
[kafka] branch 2.6 updated: KAFKA-12321 the comparison function for
uuid type should be 'equals' rather than '==' (#10098)
This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch 2.6
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/2.6 by this push:
new 92134ef KAFKA-12321 the comparison function for uuid type should be 'equals' rather than '==' (#10098)
92134ef is described below
commit 92134ef5e73c9512923b781b86162d9baefa828f
Author: Chia-Ping Tsai <ch...@gmail.com>
AuthorDate: Sat Feb 13 01:11:34 2021 +0800
KAFKA-12321 the comparison function for uuid type should be 'equals' rather than '==' (#10098)
Reviewers: Ismael Juma <is...@juma.me.uk>
---
.../test/java/org/apache/kafka/common/message/MessageTest.java | 10 ++++++++++
.../java/org/apache/kafka/message/MessageDataGenerator.java | 2 +-
2 files changed, 11 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 e0d7047..15b6c73 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
@@ -690,6 +690,16 @@ public final class MessageTest {
}
@Test
+ public void defaultValueShouldBeWritable() {
+ for (short version = 0; version <= SimpleExampleMessageData.SCHEMAS.length - 1; ++version) {
+ ObjectSerializationCache cache = new ObjectSerializationCache();
+ Message message = new SimpleExampleMessageData();
+ ByteBuffer buf = ByteBuffer.allocate(message.size(cache, version));
+ message.write(new ByteBufferAccessor(buf), cache, 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/MessageDataGenerator.java b/generator/src/main/java/org/apache/kafka/message/MessageDataGenerator.java
index 46ea053..d0bae1d 100644
--- a/generator/src/main/java/org/apache/kafka/message/MessageDataGenerator.java
+++ b/generator/src/main/java/org/apache/kafka/message/MessageDataGenerator.java
@@ -1235,7 +1235,7 @@ public final class MessageDataGenerator {
field.camelCaseName(), field.camelCaseName());
}
}
- } else if (field.type().isString() || field.type().isStruct()) {
+ } else if (field.type().isString() || field.type().isStruct() || field.type() instanceof FieldType.UUIDFieldType) {
if (fieldDefault(field).equals("null")) {
buffer.printf("if (%s != null) {%n", field.camelCaseName());
} else if (nullableVersions.empty()) {