This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new f2ee3fa  [pulsar-io] [kafka-connect-adapter] KafkaSourceRecord - 
Initialize key property with Optional.empty() if keyBytes from SourceRecord is 
null (Optional property should never itself be null) (#5591)
f2ee3fa is described below

commit f2ee3fa6ab98ed284cd352a33286aa35135c237e
Author: Naveen Kumar <krnavee...@gmail.com>
AuthorDate: Sat Nov 9 01:15:32 2019 +0530

    [pulsar-io] [kafka-connect-adapter] KafkaSourceRecord - Initialize key 
property with Optional.empty() if keyBytes from SourceRecord is null (Optional 
property should never itself be null) (#5591)
---
 .../java/org/apache/pulsar/io/kafka/connect/KafkaConnectSource.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git 
a/pulsar-io/kafka-connect-adaptor/src/main/java/org/apache/pulsar/io/kafka/connect/KafkaConnectSource.java
 
b/pulsar-io/kafka-connect-adaptor/src/main/java/org/apache/pulsar/io/kafka/connect/KafkaConnectSource.java
index d9662c4..1bdd6c4 100644
--- 
a/pulsar-io/kafka-connect-adaptor/src/main/java/org/apache/pulsar/io/kafka/connect/KafkaConnectSource.java
+++ 
b/pulsar-io/kafka-connect-adaptor/src/main/java/org/apache/pulsar/io/kafka/connect/KafkaConnectSource.java
@@ -187,9 +187,7 @@ public class KafkaConnectSource implements 
Source<KeyValue<byte[], byte[]>> {
                 srcRecord.topic(), srcRecord.keySchema(), srcRecord.key());
             byte[] valueBytes = valueConverter.fromConnectData(
                 srcRecord.topic(), srcRecord.valueSchema(), srcRecord.value());
-            if (keyBytes != null) {
-                this.key = 
Optional.of(Base64.getEncoder().encodeToString(keyBytes));
-            }
+            this.key = keyBytes != null ? 
Optional.of(Base64.getEncoder().encodeToString(keyBytes)) : Optional.empty();
             this.value = new KeyValue(keyBytes, valueBytes);
 
             this.topicName = Optional.of(srcRecord.topic());

Reply via email to