You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ca...@apache.org on 2022/03/25 01:44:07 UTC
[dolphinscheduler] branch dev updated: fix alert instance proxy configs when no username and password (#9171)
This is an automated email from the ASF dual-hosted git repository.
caishunfeng pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 9780739 fix alert instance proxy configs when no username and password (#9171)
9780739 is described below
commit 97807390a25d8c88bbad75c98539b597d70b5289
Author: Tq <ti...@gmail.com>
AuthorDate: Fri Mar 25 09:43:59 2022 +0800
fix alert instance proxy configs when no username and password (#9171)
---
.../dolphinscheduler/plugin/alert/telegram/TelegramSender.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramSender.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramSender.java
index dd9ac0d..2472e81 100644
--- a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-telegram/src/main/java/org/apache/dolphinscheduler/plugin/alert/telegram/TelegramSender.java
+++ b/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 {