You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2020/05/30 15:14:01 UTC

[kafka] branch trunk updated: Remove redundant `containsKey` call in KafkaProducer (#8761)

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

ijuma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 0736068  Remove redundant `containsKey` call in KafkaProducer (#8761)
0736068 is described below

commit 07360680138d8cd65fb50757df0e4bf9b3ff6cc3
Author: tswstarplanet <ts...@apache.org>
AuthorDate: Sat May 30 23:13:07 2020 +0800

    Remove redundant `containsKey` call in KafkaProducer (#8761)
    
    Reviewers: Ismael Juma <is...@juma.me.uk>
---
 .../src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
index 375ada5..7d1f820 100644
--- a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
+++ b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
@@ -333,8 +333,7 @@ public class KafkaProducer<K, V> implements Producer<K, V> {
             this.producerConfig = config;
             this.time = time;
 
-            String transactionalId = userProvidedConfigs.containsKey(ProducerConfig.TRANSACTIONAL_ID_CONFIG) ?
-                    (String) userProvidedConfigs.get(ProducerConfig.TRANSACTIONAL_ID_CONFIG) : null;
+            String transactionalId = (String) userProvidedConfigs.get(ProducerConfig.TRANSACTIONAL_ID_CONFIG);
 
             this.clientId = config.getString(ProducerConfig.CLIENT_ID_CONFIG);