kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rha...@apache.org
Subject [kafka] branch 2.4 updated: MINOR: Change the order that Connect calls `config()` and `validate()` to avoid validating if the required ConfigDef is null (#8810)
Date Fri, 05 Jun 2020 20:41:19 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/2.4 by this push:
     new 6be91ee  MINOR: Change the order that Connect calls `config()` and `validate()` to
avoid validating if the required ConfigDef is null (#8810)
6be91ee is described below

commit 6be91ee018e02c9e77fd96ec8c95eeb9508db1da
Author: Randall Hauch <rhauch@gmail.com>
AuthorDate: Fri Jun 5 15:02:11 2020 -0500

    MINOR: Change the order that Connect calls `config()` and `validate()` to avoid validating
if the required ConfigDef is null (#8810)
    
    Author: Randall Hauch <rhauch@gmail.com>
    Reviewer: Konstantine Karantasis <konstantine@confluent.io>
---
 .../kafka/connect/runtime/AbstractHerder.java      | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java
index b5032a0..c188150 100644
--- a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java
@@ -315,22 +315,22 @@ public abstract class AbstractHerder implements Herder, TaskStatus.Listener,
Con
             Set<String> allGroups = new LinkedHashSet<>(enrichedConfigDef.groups());
 
             // do custom connector-specific validation
-            Config config = connector.validate(connectorProps);
-            if (null == config) {
+            ConfigDef configDef = connector.config();
+            if (null == configDef) {
                 throw new BadRequestException(
-                    String.format(
-                        "%s.validate() must return a Config that is not null.",
-                        connector.getClass().getName()
-                    )
+                        String.format(
+                                "%s.config() must return a ConfigDef that is not null.",
+                                connector.getClass().getName()
+                        )
                 );
             }
-            ConfigDef configDef = connector.config();
-            if (null == configDef) {
+            Config config = connector.validate(connectorProps);
+            if (null == config) {
                 throw new BadRequestException(
-                    String.format(
-                        "%s.config() must return a ConfigDef that is not null.",
-                        connector.getClass().getName()
-                    )
+                        String.format(
+                                "%s.validate() must return a Config that is not null.",
+                                connector.getClass().getName()
+                        )
                 );
             }
             configKeys.putAll(configDef.configKeys());


Mime
View raw message