Skip to content

Commit 38dbe85

Browse files
committed
[#367][BugFix]enhance unqualified load-url config validate and test
1 parent cc8689d commit 38dbe85

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/com/starrocks/connector/flink/table/sink/StarRocksSinkOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public boolean isUseUnifiedSinkApi() {
380380
private void validateStreamLoadUrl() {
381381
tableOptions.getOptional(LOAD_URL).ifPresent(urlList -> {
382382
for (String host : urlList) {
383-
if (host.split(":").length < 2) {
383+
if (host.split(":").length != 2) {
384384
throw new ValidationException(String.format(
385385
"Could not parse host '%s' in option '%s'. It should follow the format 'host_name:port'.",
386386
host,

starrocks-stream-load-sdk/src/main/java/com/starrocks/data/load/stream/DefaultStreamLoader.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
import java.io.Serializable;
4747
import java.net.HttpURLConnection;
48+
import java.net.MalformedURLException;
4849
import java.net.URL;
4950
import java.util.Collections;
5051
import java.util.HashMap;
@@ -388,6 +389,8 @@ private boolean testHttpConnection(String host) {
388389
connection.connect();
389390
connection.disconnect();
390391
return true;
392+
} catch (MalformedURLException e) {
393+
throw new IllegalArgumentException("Illegal stream load url config, please check config value.", e);
391394
} catch (Exception e) {
392395
log.warn("Failed to connect to address:{}", host, e);
393396
return false;

0 commit comments

Comments
 (0)