From 07913e7d5160b86391bf21f739276e459d9aa83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=81=E7=94=B2=E5=B0=8F=E5=AE=9D?= <2922035952@qq.com> Date: Thu, 18 Jul 2024 01:01:29 +0800 Subject: [PATCH] A small code specification change. (#2299) --- .../apache/hertzbeat/manager/service/impl/MailServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MailServiceImpl.java b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MailServiceImpl.java index 4e91ea73d6f..ec627f81548 100644 --- a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MailServiceImpl.java +++ b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MailServiceImpl.java @@ -18,6 +18,7 @@ package org.apache.hertzbeat.manager.service.impl; import freemarker.cache.StringTemplateLoader; +import freemarker.core.TemplateClassResolver; import freemarker.template.Configuration; import freemarker.template.TemplateException; import java.io.IOException; @@ -99,6 +100,7 @@ public String buildAlertHtmlTemplate(final Alert alert, NoticeTemplate noticeTem String templateName = "mailTemplate"; stringLoader.putTemplate(templateName, noticeTemplate.getContent()); cfg.setTemplateLoader(stringLoader); + cfg.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER); templateMail = cfg.getTemplate(templateName, Locale.CHINESE); return FreeMarkerTemplateUtils.processTemplateIntoString(templateMail, model); }