From 6004526c65ab30fa51d8d456a282786f3471ff0d Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 09 Aug 2022 15:56:19 +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