From 58c4a118bad3d33a553915781c9711d7bf2f6ee2 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Thu, 11 Aug 2022 12:07:21 +0800 Subject: [PATCH] fix --- src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java b/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java index 22ac0dc..05e363f 100644 --- a/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java +++ b/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java @@ -1,5 +1,6 @@ package com.xcong.farmer.cms.core.template; +import com.xcong.farmer.cms.common.exception.GlobalException; import com.xcong.farmer.cms.common.utils.FileUtils; import com.xcong.farmer.cms.core.node.PartNode; import com.xcong.farmer.cms.core.node.Template; @@ -54,7 +55,13 @@ } public Template template(String templatePath, String templateName) { - return template(new File(path(templatePath) + templateName)); + File file = new File(path(templatePath) + templateName); + if (!file.exists()) { + log.info("模板文件不存在 : {}", templateName); + throw new GlobalException("模板文件不存在:" + templateName); + } + + return template(file); } public Template template(File file) { -- Gitblit v1.9.1