Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
DolphinScheduler
提交
1a86e7ba
DolphinScheduler
项目概览
apache
/
DolphinScheduler
上一次同步 1 年多
通知
706
Star
9572
Fork
3514
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1a86e7ba
编写于
1月 10, 2020
作者:
Y
Yelli
提交者:
qiaozhanwei
1月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add retMap null check for AlertSender (#1796)
* fix bug: zk hasTask method NPE * add retMap null check for AlertSender
上级
b9ac6d66
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
15 deletion
+19
-15
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java
...org/apache/dolphinscheduler/alert/runner/AlertSender.java
+14
-9
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/ExcelUtils.java
...a/org/apache/dolphinscheduler/alert/utils/ExcelUtils.java
+2
-1
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
...va/org/apache/dolphinscheduler/alert/utils/MailUtils.java
+3
-5
未找到文件。
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java
浏览文件 @
1a86e7ba
...
...
@@ -31,6 +31,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -72,9 +73,7 @@ public class AlertSender{
String
receivers
=
alert
.
getReceivers
();
if
(
StringUtils
.
isNotEmpty
(
receivers
)){
String
[]
splits
=
receivers
.
split
(
","
);
for
(
String
receiver
:
splits
){
receviersList
.
add
(
receiver
);
}
receviersList
.
addAll
(
Arrays
.
asList
(
splits
));
}
// copy list
...
...
@@ -86,9 +85,7 @@ public class AlertSender{
if
(
StringUtils
.
isNotEmpty
(
receiversCc
)){
String
[]
splits
=
receiversCc
.
split
(
","
);
for
(
String
receiverCc
:
splits
){
receviersCcList
.
add
(
receiverCc
);
}
receviersCcList
.
addAll
(
Arrays
.
asList
(
splits
));
}
if
(
CollectionUtils
.
isEmpty
(
receviersList
)
&&
CollectionUtils
.
isEmpty
(
receviersCcList
))
{
...
...
@@ -106,7 +103,13 @@ public class AlertSender{
alert
.
setInfo
(
retMaps
);
}
boolean
flag
=
Boolean
.
parseBoolean
(
String
.
valueOf
(
retMaps
.
get
(
Constants
.
STATUS
)));
//send flag
boolean
flag
=
false
;
if
(
null
!=
retMaps
)
{
flag
=
Boolean
.
parseBoolean
(
String
.
valueOf
(
retMaps
.
get
(
Constants
.
STATUS
)));
}
if
(
flag
)
{
alertDao
.
updateAlert
(
AlertStatus
.
EXECUTION_SUCCESS
,
"execution success"
,
alert
.
getId
());
logger
.
info
(
"alert send success"
);
...
...
@@ -121,8 +124,10 @@ public class AlertSender{
}
}
else
{
alertDao
.
updateAlert
(
AlertStatus
.
EXECUTION_FAILURE
,
String
.
valueOf
(
retMaps
.
get
(
Constants
.
MESSAGE
)),
alert
.
getId
());
logger
.
info
(
"alert send error : {}"
,
String
.
valueOf
(
retMaps
.
get
(
Constants
.
MESSAGE
)));
if
(
null
!=
retMaps
)
{
alertDao
.
updateAlert
(
AlertStatus
.
EXECUTION_FAILURE
,
String
.
valueOf
(
retMaps
.
get
(
Constants
.
MESSAGE
)),
alert
.
getId
());
logger
.
info
(
"alert send error : {}"
,
retMaps
.
get
(
Constants
.
MESSAGE
));
}
}
}
...
...
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/ExcelUtils.java
浏览文件 @
1a86e7ba
...
...
@@ -16,6 +16,7 @@
*/
package
org.apache.dolphinscheduler.alert.utils
;
import
org.apache.dolphinscheduler.common.utils.CollectionUtils
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
import
org.apache.poi.hssf.usermodel.HSSFSheet
;
...
...
@@ -47,7 +48,7 @@ public class ExcelUtils {
//The JSONUtils.toList has been try catch ex
itemsList
=
JSONUtils
.
toList
(
content
,
LinkedHashMap
.
class
);
if
(
itemsList
==
null
||
itemsList
.
size
()
==
0
){
if
(
CollectionUtils
.
isEmpty
(
itemsList
)
){
logger
.
error
(
"itemsList is null"
);
throw
new
RuntimeException
(
"itemsList is null"
);
}
...
...
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java
浏览文件 @
1a86e7ba
...
...
@@ -25,7 +25,6 @@ import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import
org.apache.dolphinscheduler.common.utils.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.util.ResourceUtils
;
import
javax.mail.*
;
import
javax.mail.internet.*
;
...
...
@@ -33,7 +32,6 @@ import java.io.*;
import
java.util.*
;
/**
* mail utils
*/
...
...
@@ -320,12 +318,12 @@ public class MailUtils {
public
static
void
deleteFile
(
File
file
){
if
(
file
.
exists
()){
if
(
file
.
delete
()){
logger
.
info
(
"delete success:
"
+
file
.
getAbsolutePath
()+
file
.
getName
());
logger
.
info
(
"delete success:
{}"
,
file
.
getAbsolutePath
()
+
file
.
getName
());
}
else
{
logger
.
info
(
"delete fail
"
+
file
.
getAbsolutePath
()+
file
.
getName
());
logger
.
info
(
"delete fail
: {}"
,
file
.
getAbsolutePath
()
+
file
.
getName
());
}
}
else
{
logger
.
info
(
"file not exists:
"
+
file
.
getAbsolutePath
()+
file
.
getName
());
logger
.
info
(
"file not exists:
{}"
,
file
.
getAbsolutePath
()
+
file
.
getName
());
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录