REQ-2135: fix bugs

This commit is contained in:
yanglin 2024-04-01 15:28:41 +08:00
parent 5ee8ea4fe5
commit ff23d4c104

View File

@ -3,7 +3,6 @@ package cn.axzo.msg.center.common.utils;
import cn.axzo.basics.common.exception.ServiceException;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.builder.BuilderException;
import org.springframework.context.expression.MapAccessor;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
@ -43,7 +42,7 @@ public class TemplateParser {
TemplateParserContext templateContext = new TemplateParserContext(openToken, closeToken);
Expression exp = new SpelExpressionParser().parseExpression(expression, templateContext);
return exp.getValue(evalContext, String.class);
} catch (BuilderException e) {
} catch (Exception e) {
log.warn("无效的模版内容, 请检查格式是否正确. expression={}, value={}",
expression, JSON.toJSONString(root), e);
throw new ServiceException(String.format("无效的模版内容, 请检查格式是否正确. expression=%s, value=%s",
@ -70,4 +69,7 @@ public class TemplateParser {
}
public static void main(String[] args) {
TemplateParser.parseDollarSign("${", "");
}
}