Skip to content

Commit 6cf53dc

Browse files
authored
Merge pull request #24 from rhysmccaig/version_3.1.0
Add null checks to config and bump version
2 parents 663883b + fcb235d commit 6cf53dc

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ plugins {
1515
id 'idea'
1616
}
1717

18-
version = '3.0.3'
18+
version = '3.1.0'
1919

2020
dependencies {
2121
def kafkaVersion = '2.0.0'

src/main/java/com/comcast/kafka/connect/kafka/KafkaSourceConnectorConfig.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import java.util.List;
2626
import java.util.Map;
27+
import java.util.Objects;
2728
import java.util.HashMap;
2829
import java.util.Properties;
2930
import java.util.regex.Pattern;
@@ -35,7 +36,7 @@ public class KafkaSourceConnectorConfig extends AbstractConfig {
3536
@Override
3637
@SuppressWarnings("unchecked")
3738
public void ensureValid(String name, Object value) {
38-
if (((List<String>) value).isEmpty()) {
39+
if (Objects.isNull(value) || ((List<String>) value).isEmpty()) {
3940
throw new ConfigException("At least one bootstrap server must be configured in " + name);
4041
}
4142
}
@@ -239,8 +240,10 @@ public Pattern getTopicWhitelistPattern() {
239240

240241
// Returns a java regex pattern that can be used to match kafka topics
241242
private static Pattern getTopicWhitelistPattern(String rawRegex) {
242-
String regex = rawRegex.trim().replace(',', '|').replace(" ", "").replaceAll("^[\"']+", "").replaceAll("[\"']+$",
243-
""); // property files may bring quotes
243+
String regex = new String();
244+
if (Objects.nonNull(rawRegex)) {
245+
regex = rawRegex.trim().replace(',', '|').replace(" ", "").replaceAll("^[\"']+", "").replaceAll("[\"']+$",""); // property files may bring quotes
246+
}
244247
try {
245248
return Pattern.compile(regex);
246249
} catch (PatternSyntaxException e) {

0 commit comments

Comments
 (0)