abbccdda commented on a change in pull request #11333:
URL: https://github.com/apache/kafka/pull/11333#discussion_r711655376



##########
File path: 
connect/api/src/main/java/org/apache/kafka/connect/connector/Connector.java
##########
@@ -150,4 +152,15 @@ public Config validate(Map<String, String> 
connectorConfigs) {
      * @return The ConfigDef for this connector; may not be null.
      */
     public abstract ConfigDef config();
+
+    private void validateConfigDoesNotContainNull(Map<String, String> 
connectorConfigs) {
+        final String keysWithNullValue = connectorConfigs.entrySet().stream()
+                .filter(entry -> entry.getValue() == null)
+                .map(Map.Entry::getKey)
+                .collect(Collectors.joining(", "));
+
+        if (!keysWithNullValue.isEmpty()) {
+            throw new ConnectException(String.format("Null value found in 
config for key(s) %s", keysWithNullValue));

Review comment:
       Should this just be IllegalArgumentException?

##########
File path: 
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/AbstractHerderTest.java
##########
@@ -289,6 +290,23 @@ public void testBuildRestartPlanForUnknownConnector() {
         assertFalse(mayBeRestartPlan.isPresent());
     }
 
+    @Test
+    public void testConfigValidationNullConfig() {

Review comment:
       Could you also add a test case with multiple null values as well?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to