Skip to content

KAFKA-20693: fix npe in abstract herder when no config value#22588

Open
gaetancollaud wants to merge 2 commits into
apache:trunkfrom
gaetancollaud:bugfix/KAFKA-20693-npe-in-abstract-herder-when-no-config-value
Open

KAFKA-20693: fix npe in abstract herder when no config value#22588
gaetancollaud wants to merge 2 commits into
apache:trunkfrom
gaetancollaud:bugfix/KAFKA-20693-npe-in-abstract-herder-when-no-config-value

Conversation

@gaetancollaud

Copy link
Copy Markdown

Summary

Debezium (and maybe others) has a concept of deprecated fields. Those fields are returned by the config() method but are omitted from validate().

After the validation of a connector fail, AbstractHerder loops over the keys from config() but then tries to get the configValue() returned by validate() this creates a NPE.

Other solution

Instead of checking for null, another fix would be to not add the null ConfigValueInfo in the first place:

// line 980 of AbstractHerder.java
ConfigValueInfo configValueInfo = null;
if (configValueMap.containsKey(configName)) {
    ConfigValue configValue = configValueMap.get(configName);
    configValueInfo = convertConfigValue(configValue, type);
    errorCount += configValue.errorMessages().size();
}
configInfoList.add(new ConfigInfo(configKeyInfo, configValueInfo)); // move this inside the if above

Tests

  • I modified SampleSourceConnector to not return all the fields in validate()
  • I added testDifferenceInConfigDefAndValidation in AbstractHerderTest

@github-actions github-actions Bot added triage PRs from the community connect small Small PRs labels Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

connect small Small PRs triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant