Skip to content

Commit 0c1a5c5

Browse files
Merge branch '5.0.x' into 5.1.x
2 parents 39a8ba2 + 4f54484 commit 0c1a5c5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/java/io/confluent/connect/elasticsearch/ElasticsearchSinkConnectorConfig.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,13 @@ private Map<String, String> parseMapConfig(List<String> values) {
608608
private static class UrlListValidator implements Validator {
609609

610610
@Override
611+
@SuppressWarnings("unchecked")
611612
public void ensureValid(String name, Object value) {
612-
@SuppressWarnings("unchecked")
613+
if (value == null) {
614+
throw new ConfigException(
615+
name, value, "The provided url list is null."
616+
);
617+
}
613618
List<String> urls = (List<String>) value;
614619
for (String url : urls) {
615620
try {

src/test/java/io/confluent/connect/elasticsearch/ElasticsearchSinkConnectorConfigTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import static io.confluent.connect.elasticsearch.ElasticsearchSinkConnectorConfig.TYPE_NAME_CONFIG;
88
import static org.junit.Assert.assertEquals;
99

10+
import org.apache.kafka.common.config.ConfigException;
1011
import org.junit.Before;
1112
import org.junit.Test;
1213

@@ -40,4 +41,10 @@ public void testSetHttpTimeoutsConfig() {
4041
assertEquals(config.readTimeoutMs(), 10000);
4142
assertEquals(config.connectionTimeoutMs(), 15000);
4243
}
44+
45+
@Test(expected = ConfigException.class)
46+
public void shouldNotAllowNullUrlList(){
47+
props.put(CONNECTION_URL_CONFIG, null);
48+
new ElasticsearchSinkConnectorConfig(props);
49+
}
4350
}

0 commit comments

Comments
 (0)