From e51c7c6052d775b439c6a88575811fc1a5dccb41 Mon Sep 17 00:00:00 2001 From: feiL Date: Sun, 18 Feb 2024 16:15:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(issues#I8X0NW):=20=E5=A4=9A=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=8A=A0=E8=BD=BD=E7=9B=91=E5=90=AC=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit com.yomahub.liteflow.spi.spring.SpringPathContentParser#getResources 97行判断逻辑抽出 --- .../yomahub/liteflow/spi/spring/SpringPathContentParser.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/liteflow-spring/src/main/java/com/yomahub/liteflow/spi/spring/SpringPathContentParser.java b/liteflow-spring/src/main/java/com/yomahub/liteflow/spi/spring/SpringPathContentParser.java index 13720854..c77ef844 100644 --- a/liteflow-spring/src/main/java/com/yomahub/liteflow/spi/spring/SpringPathContentParser.java +++ b/liteflow-spring/src/main/java/com/yomahub/liteflow/spi/spring/SpringPathContentParser.java @@ -29,6 +29,7 @@ public class SpringPathContentParser implements PathContentParser { public List parseContent(List pathList) throws Exception { List absolutePathList = PathMatchUtil.searchAbsolutePath(pathList); List allResource = getResources(absolutePathList); + verifyFileExtName(allResource); // 转换成内容List List contentList = new ArrayList<>(); @@ -90,14 +91,16 @@ public class SpringPathContentParser implements PathContentParser { allResource.addAll(ListUtil.toList(resources)); } } + return allResource; + } + private void verifyFileExtName(List allResource) { // 检查资源都是同一个类型,如果出现不同类型的配置,则抛出错误提示 Set fileTypeSet = new HashSet<>(); allResource.forEach(resource -> fileTypeSet.add(FileUtil.extName(resource.getFilename()))); if (fileTypeSet.size() > 1) { throw new ConfigErrorException("config error,please use the same type of configuration"); } - return allResource; } @Override