Fix NPE in Kafka Streams binder

Fixing an NPE when type for the binder is not explicitly provided as a configuration.

Resolves #516
Resolves #524
Polishing
This commit is contained in:
Soby Chacko
2019-01-02 19:10:48 -05:00
committed by Oleg Zhurakousky
parent d63f9e5fa6
commit 0b8a760b5a
2 changed files with 2 additions and 3 deletions

View File

@@ -78,9 +78,9 @@ public class KafkaStreamsBinderSupportAutoConfiguration {
for (Map.Entry<String, BinderConfiguration> entry : binderConfigurations.entrySet()) {
final BinderConfiguration binderConfiguration = entry.getValue();
final String binderType = binderConfiguration.getBinderType();
if (binderType.equals(KSTREAM_BINDER_TYPE) ||
if (binderType != null && (binderType.equals(KSTREAM_BINDER_TYPE) ||
binderType.equals(KTABLE_BINDER_TYPE) ||
binderType.equals(GLOBALKTABLE_BINDER_TYPE)) {
binderType.equals(GLOBALKTABLE_BINDER_TYPE))) {
Map<String, Object> binderProperties = new HashMap<>();
this.flatten(null, binderConfiguration.getProperties(), binderProperties);
environment.getPropertySources().addFirst(new MapPropertySource("kafkaStreamsBinderEnv", binderProperties));

View File

@@ -35,7 +35,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.CreateTopicsResult;