From 0c26e10f3fda98492358a85a51cb609df9ef7033 Mon Sep 17 00:00:00 2001 From: Shiwen Cheng Date: Thu, 11 Feb 2021 09:54:07 +0800 Subject: [PATCH] [Fix-4738][Mail] Fix send mail failed instead of execute sql error (#4739) --- .../dolphinscheduler/server/worker/task/sql/SqlTask.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java index 4c328edbe0..411032fd1f 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java @@ -298,8 +298,12 @@ public class SqlTask extends AbstractTask { String result = JSONUtils.toJsonString(resultJSONArray); logger.debug("execute sql : {}", result); - sendAttachment(sqlParameters.getGroupId(), StringUtils.isNotEmpty(sqlParameters.getTitle()) ? sqlParameters.getTitle() : taskExecutionContext.getTaskName() + " query result sets", - JSONUtils.toJsonString(resultJSONArray)); + try { + sendAttachment(sqlParameters.getGroupId(), StringUtils.isNotEmpty(sqlParameters.getTitle()) ? sqlParameters.getTitle() : taskExecutionContext.getTaskName() + " query result sets", + JSONUtils.toJsonString(resultJSONArray)); + } catch (Exception e) { + logger.warn("sql task sendAttachment error! msg : {} ", e.getMessage()); + } } /**