kafka-connect-client icon indicating copy to clipboard operation
kafka-connect-client copied to clipboard

Config validation: Null pointer exception on some kafka client override configs

Open chuck-alt-delete opened this issue 1 year ago • 0 comments

Ran a test with an invalid consumer override config:

    @Test
    public void testValidateConnectorPluginConfig() {
        ConnectorPluginConfigValidationResults results = kafkaConnectClient.validateConnectorPluginConfig(
            ConnectorPluginConfigDefinition.newBuilder()
                .withName("JdbcSinkConnector")
                .withConfig("connector.class", "io.confluent.connect.jdbc.JdbcSinkConnector")
                .withConfig("tasks.max", "1")
                .withConfig("connection.url", "jdbc:postgresql://postgres:5432/postgres?user=postgres&password=pwd&ssl=false")
                .withConfig("mode", "incrementing")
                .withConfig("topics", "pageviews")
                .withConfig("consumer.override.this.doesnt.exist.ms", "20000")
                .withConfig("name", "test")
                .build()
        );
...

Error:

java.lang.NullPointerException: Cannot invoke "org.sourcelab.kafka.connect.apiclient.request.dto.ConnectorPluginConfigValidationResults$Config$Definition.getName()" because the return value of "org.sourcelab.kafka.connect.apiclient.request.dto.ConnectorPluginConfigValidationResults$Config.getDefinition()" is null

Here are some other configs I tried with results in the comments:

    @Test
    public void testValidateConnectorPluginConfig() {
        ConnectorPluginConfigValidationResults results = kafkaConnectClient.validateConnectorPluginConfig(
            ConnectorPluginConfigDefinition.newBuilder()
                .withName("JdbcSinkConnector")
                .withConfig("connector.class", "io.confluent.connect.jdbc.JdbcSinkConnector")
                .withConfig("tasks.max", "1")
                .withConfig("connection.url", "jdbc:postgresql://postgres:5432/postgres?user=postgres&password=pwd&ssl=false")
                .withConfig("mode", "incrementing")
                .withConfig("topics", "pageviews")
                .withConfig("name", "test")
                 // .withConfig("producer.override.blah.blah", "1000") // passes, config ignored
                // .withConfig("producer.override.linger.ms", "1000") // passes, config ignored
                // .withConfig("this.doesnt.exist.ms", "20000") // passes, config ignored
                // .withConfig("consumer.override.this.doesnt.exist.ms", "20000") // null pointer exception
                // .withConfig("consumer.override.max.poll.records", "1000") // passes
                // .withConfig("consumer.override.max.poll.interval.ms", "200000") // passes
                // .withConfig("consumer.override.group.id", "beep") // should pass but gets null pointer exception
                // .withConfig("consumer.override.isolation.level", "read_committed") // passes
                .build()
        );
...

I tested producer overrides also with the source connector and, likewise, producer.override.blah.blah leads to null pointer exception in that case.

chuck-alt-delete avatar Apr 24 '25 19:04 chuck-alt-delete