tracehh commented on code in PR #11033:
URL: https://github.com/apache/dolphinscheduler/pull/11033#discussion_r926548179


##########
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java:
##########
@@ -93,6 +100,19 @@ public void send(List<Alert> alerts) {
                 continue;
             }
             AlertData alertData = new AlertData();
+
+            if (StringUtils.isNotEmpty(alert.getContent())) {
+                try {
+                    Object contentObject = new 
JSONTokener(alert.getContent()).nextValue();
+                    if (!(contentObject instanceof JSONArray)) {
+                        ObjectNode jsonNodes = 
JSONUtils.parseObject(alert.getContent());
+                        String content = 
JSONUtils.toJsonString(Collections.singletonList(jsonNodes));
+                        alert.setContent(content);
+                    }
+                } catch (JSONException e) {
+                    e.printStackTrace();

Review Comment:
   use  `logger.error("")` to log



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to