kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject [kafka] branch 2.0 updated: KAFKA-7048 NPE when creating connector (#5202)
Date Sun, 17 Jun 2018 23:50:07 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/2.0 by this push:
     new d1ebab5  KAFKA-7048 NPE when creating connector (#5202)
d1ebab5 is described below

commit d1ebab573b0267bb5c53010bd004270801e79a04
Author: Chia-Ping Tsai <chia7712@gmail.com>
AuthorDate: Mon Jun 18 07:49:01 2018 +0800

    KAFKA-7048 NPE when creating connector (#5202)
    
    Reviewers: Robert Yokota <rayokota@gmail.com>, Konstantine Karantasis <konstantine@confluent.io>,
Guozhang Wang <wangguoz@gmail.com>
---
 .../org/apache/kafka/connect/runtime/WorkerConfigTransformer.java   | 1 +
 .../apache/kafka/connect/runtime/WorkerConfigTransformerTest.java   | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConfigTransformer.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConfigTransformer.java
index b8465c0..7efb481 100644
--- a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConfigTransformer.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerConfigTransformer.java
@@ -39,6 +39,7 @@ public class WorkerConfigTransformer {
     }
 
     public Map<String, String> transform(String connectorName, Map<String, String>
configs) {
+        if (configs == null) return null;
         ConfigTransformerResult result = configTransformer.transform(configs);
         scheduleReload(connectorName, result.ttls());
         return result.data();
diff --git a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerConfigTransformerTest.java
b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerConfigTransformerTest.java
index edd4a6c..300022d 100644
--- a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerConfigTransformerTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerConfigTransformerTest.java
@@ -32,6 +32,7 @@ import java.util.Map;
 import java.util.Set;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.powermock.api.easymock.PowerMock.replayAll;
 
 @RunWith(PowerMockRunner.class)
@@ -110,6 +111,11 @@ public class WorkerConfigTransformerTest {
         assertEquals(TEST_RESULT_WITH_LONGER_TTL, result.get(MY_KEY));
     }
 
+    @Test
+    public void testTransformNullConfiguration() {
+        assertNull(configTransformer.transform(MY_CONNECTOR, null));
+    }
+
     public static class TestConfigProvider implements ConfigProvider {
 
         public void configure(Map<String, ?> configs) {

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

Mime
View raw message