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

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


The following commit(s) were added to refs/heads/2.3 by this push:
     new 46fbc0f  KAFKA-8974: Trim whitespaces in topic names in sink connector 
configs (#7442)
46fbc0f is described below

commit 46fbc0f2adf76f100ac27ca308efb39cca79b89f
Author: Magesh Nandakumar <[email protected]>
AuthorDate: Fri Oct 4 11:12:32 2019 -0700

    KAFKA-8974: Trim whitespaces in topic names in sink connector configs 
(#7442)
    
    Trim whitespaces in topic names specified in sink connector configs before 
subscribing to the consumer. Topic names don't allow whitespace characters, so 
trimming only will eliminate potential problems and will not place additional 
limits on topics specified in sink connectors.
    
    Author: Magesh Nandakumar <[email protected]>
    Reviewers: Arjun Satish <[email protected]>, Randall Hauch 
<[email protected]>
---
 .../src/main/java/org/apache/kafka/connect/runtime/WorkerSinkTask.java   | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerSinkTask.java
 
b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerSinkTask.java
index f21c500..067d604 100644
--- 
a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerSinkTask.java
+++ 
b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerSinkTask.java
@@ -287,6 +287,7 @@ class WorkerSinkTask extends WorkerTask {
 
         if (SinkConnectorConfig.hasTopicsConfig(taskConfig)) {
             String[] topics = 
taskConfig.get(SinkTask.TOPICS_CONFIG).split(",");
+            Arrays.setAll(topics, i -> topics[i].trim());
             consumer.subscribe(Arrays.asList(topics), new HandleRebalance());
             log.debug("{} Initializing and starting task for topics {}", this, 
topics);
         } else {

Reply via email to