C0urante commented on a change in pull request #11369:
URL: https://github.com/apache/kafka/pull/11369#discussion_r718554974



##########
File path: 
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/ConnectorConfig.java
##########
@@ -425,7 +439,10 @@ void enrich(ConfigDef newDef) {
                 final ConfigDef.Validator typeValidator = 
ConfigDef.LambdaValidator.with(
                     (String name, Object value) -> {
                         validateProps(prefix);
-                        getConfigDefFromConfigProvidingClass(typeConfig, 
(Class<?>) value);
+                        // The value will be null if the class couldn't be 
found; no point in trying to load a ConfigDef for it
+                        if (value != null) {
+                            getConfigDefFromConfigProvidingClass(typeConfig, 
(Class<?>) value);
+                        }

Review comment:
       This fixes an issue present in our [unit 
tests](https://github.com/apache/kafka/blob/0888953e0e834bf849751a36ae5adf92b20ec0a5/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/AbstractHerderTest.java#L495)
 where multiple error messages are added for a single invalid 
transform/predicate property when the class cannot be found. It's best if a 
single error message is returned stating that the class cannot be found; the 
second message (something along the lines of "invalid value null for property 
...") did not add any value.




-- 
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