kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mj...@apache.org
Subject [kafka] branch trunk updated: MINOR: Change order of Property Check To Avoid NPE (#5528)
Date Fri, 17 Aug 2018 22:44:15 GMT
This is an automated email from the ASF dual-hosted git repository.

mjsax 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 bf2c46a  MINOR: Change order of Property Check To Avoid NPE (#5528)
bf2c46a is described below

commit bf2c46a0b8266562bf4697dc8e3e9443059f9abb
Author: Bill Bejeck <bbejeck@gmail.com>
AuthorDate: Fri Aug 17 18:44:08 2018 -0400

    MINOR: Change order of Property Check To Avoid NPE (#5528)
    
    Reviewer: Matthias J. Sax <matthias@confluent.io>
---
 .../kafka/streams/kstream/internals/InternalStreamsBuilder.java   | 2 +-
 .../test/java/org/apache/kafka/streams/StreamsBuilderTest.java    | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/streams/src/main/java/org/apache/kafka/streams/kstream/internals/InternalStreamsBuilder.java
b/streams/src/main/java/org/apache/kafka/streams/kstream/internals/InternalStreamsBuilder.java
index e5cd066..c1532af 100644
--- a/streams/src/main/java/org/apache/kafka/streams/kstream/internals/InternalStreamsBuilder.java
+++ b/streams/src/main/java/org/apache/kafka/streams/kstream/internals/InternalStreamsBuilder.java
@@ -292,7 +292,7 @@ public class InternalStreamsBuilder implements InternalNameProvider {
 
     private void maybePerformOptimizations(final Properties props) {
 
-        if (props != null && props.getProperty(StreamsConfig.TOPOLOGY_OPTIMIZATION).equals(StreamsConfig.OPTIMIZE))
{
+        if (props != null && StreamsConfig.OPTIMIZE.equals(props.getProperty(StreamsConfig.TOPOLOGY_OPTIMIZATION)))
{
             LOG.debug("Optimizing the Kafka Streams graph for repartition nodes");
             maybeOptimizeRepartitionOperations();
         }
diff --git a/streams/src/test/java/org/apache/kafka/streams/StreamsBuilderTest.java b/streams/src/test/java/org/apache/kafka/streams/StreamsBuilderTest.java
index 4fab4ff..2531591 100644
--- a/streams/src/test/java/org/apache/kafka/streams/StreamsBuilderTest.java
+++ b/streams/src/test/java/org/apache/kafka/streams/StreamsBuilderTest.java
@@ -56,6 +56,14 @@ public class StreamsBuilderTest {
     private final Properties props = StreamsTestUtils.getStreamsConfig(Serdes.String(), Serdes.String());
 
     @Test
+    public void shouldNotThrowNullPointerIfOptimizationsNotSpecified() {
+        final Properties properties = new Properties();
+
+        final StreamsBuilder builder = new StreamsBuilder();
+        builder.build(properties);
+    }
+
+    @Test
     public void shouldAllowJoinUnmaterializedFilteredKTable() {
         final KTable<Bytes, String> filteredKTable = builder.<Bytes, String>table("table-topic").filter(MockPredicate.<Bytes,
String>allGoodPredicate());
         builder.<Bytes, String>stream("stream-topic").join(filteredKTable, MockValueJoiner.TOSTRING_JOINER);


Mime
View raw message