kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [kafka] branch trunk updated: MINOR: Remove unnecessary null checks (#4708)
Date Sat, 17 Mar 2018 06:34:19 GMT
This is an automated email from the ASF dual-hosted git repository.

jgus 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 2afac71  MINOR: Remove unnecessary null checks (#4708)
2afac71 is described below

commit 2afac715666347a30ac54cef1485db369288b478
Author: Sandor Murakozi <smurakozi@gmail.com>
AuthorDate: Sat Mar 17 07:34:16 2018 +0100

    MINOR: Remove unnecessary null checks (#4708)
    
    Remove unnecessary null check in StringDeserializer, MockProducerInterceptor and KStreamImpl.
    
    Reviewers: Vahid Hashemian <vahidhashemian@us.ibm.com>, Jason Gustafson <jason@confluent.io>
---
 .../java/org/apache/kafka/common/serialization/StringDeserializer.java  | 2 +-
 .../src/test/java/org/apache/kafka/test/MockProducerInterceptor.java    | 2 +-
 .../java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/clients/src/main/java/org/apache/kafka/common/serialization/StringDeserializer.java
b/clients/src/main/java/org/apache/kafka/common/serialization/StringDeserializer.java
index c647c9b..0398a1b 100644
--- a/clients/src/main/java/org/apache/kafka/common/serialization/StringDeserializer.java
+++ b/clients/src/main/java/org/apache/kafka/common/serialization/StringDeserializer.java
@@ -34,7 +34,7 @@ public class StringDeserializer implements Deserializer<String> {
         Object encodingValue = configs.get(propertyName);
         if (encodingValue == null)
             encodingValue = configs.get("deserializer.encoding");
-        if (encodingValue != null && encodingValue instanceof String)
+        if (encodingValue instanceof String)
             encoding = (String) encodingValue;
     }
 
diff --git a/clients/src/test/java/org/apache/kafka/test/MockProducerInterceptor.java b/clients/src/test/java/org/apache/kafka/test/MockProducerInterceptor.java
index 2a0751e..133ff56 100644
--- a/clients/src/test/java/org/apache/kafka/test/MockProducerInterceptor.java
+++ b/clients/src/test/java/org/apache/kafka/test/MockProducerInterceptor.java
@@ -51,7 +51,7 @@ public class MockProducerInterceptor implements ClusterResourceListener,
Produce
         Object o = configs.get(APPEND_STRING_PROP);
         if (o == null)
             throw new ConfigException("Mock producer interceptor expects configuration "
+ APPEND_STRING_PROP);
-        if (o != null && o instanceof String)
+        if (o instanceof String)
             appendStr = (String) o;
 
         // clientId also must be in configs
diff --git a/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java
b/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java
index 349be86..857abf7 100644
--- a/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java
+++ b/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamImpl.java
@@ -502,7 +502,7 @@ public class KStreamImpl<K, V> extends AbstractStream<K> implements
KStream<K, V
         final Serializer<V> valSerializer = produced.valueSerde() == null ? null :
produced.valueSerde().serializer();
         final StreamPartitioner<? super K, ? super V> partitioner = produced.streamPartitioner();
 
-        if (partitioner == null && keySerializer != null && keySerializer
instanceof WindowedSerializer) {
+        if (partitioner == null && keySerializer instanceof WindowedSerializer) {
             final StreamPartitioner<K, V> windowedPartitioner = (StreamPartitioner<K,
V>) new WindowedStreamPartitioner<Object, V>(topic, (WindowedSerializer) keySerializer);
             builder.internalTopologyBuilder.addSink(name, topic, keySerializer, valSerializer,
windowedPartitioner, this.name);
         } else {

-- 
To stop receiving notification emails like this one, please contact
jgus@apache.org.

Mime
View raw message