Skip to content

Commit

Permalink
[StarRocks#367][BugFix]enhance unqualified load-url config validate a…
Browse files Browse the repository at this point in the history
…nd test

Signed-off-by: jam.xu <[email protected]>
  • Loading branch information
xumanbu committed Jun 21, 2024
1 parent cc8689d commit ad41f30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public boolean isUseUnifiedSinkApi() {
private void validateStreamLoadUrl() {
tableOptions.getOptional(LOAD_URL).ifPresent(urlList -> {
for (String host : urlList) {
if (host.split(":").length < 2) {
if (host.split(":").length != 2) {
throw new ValidationException(String.format(
"Could not parse host '%s' in option '%s'. It should follow the format 'host_name:port'.",
host,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

import java.io.Serializable;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -388,6 +389,8 @@ private boolean testHttpConnection(String host) {
connection.connect();
connection.disconnect();
return true;
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Illegal stream load url config, please check config value.", e);
} catch (Exception e) {
log.warn("Failed to connect to address:{}", host, e);
return false;
Expand Down

0 comments on commit ad41f30

Please sign in to comment.