Browse Source

fix alert instance proxy configs when no username and password (#9171)

3.0.0/version-upgrade
Tq 3 years ago committed by GitHub
parent
commit
97807390a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramSender.java

7
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramSender.java

@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.dolphinscheduler.alert.api.AlertData;
import org.apache.dolphinscheduler.alert.api.AlertResult;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpHost;
@ -136,7 +137,11 @@ public final class TelegramSender {
HttpPost httpPost = buildHttpPost(url, buildMsgJsonStr(content));
CloseableHttpClient httpClient;
if (Boolean.TRUE.equals(enableProxy)) {
httpClient = getProxyClient(proxy, port, user, password);
if (StringUtils.isNotEmpty(user) && StringUtils.isNotEmpty(password)) {
httpClient = getProxyClient(proxy, port, user, password);
}else {
httpClient = getDefaultClient();
}
RequestConfig rcf = getProxyConfig(proxy, port);
httpPost.setConfig(rcf);
} else {

Loading…
Cancel
Save