From 2247f21db8b45a181306a4f590d1fe95452018c4 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 24 Apr 2023 20:16:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20ProjectReactor=20=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E6=94=B9=E5=8C=85=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/java/cn/iocoder/yudao/ProjectReactor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yudao-gateway/src/test/java/cn/iocoder/yudao/ProjectReactor.java b/yudao-gateway/src/test/java/cn/iocoder/yudao/ProjectReactor.java index 6591df599..edcb06598 100644 --- a/yudao-gateway/src/test/java/cn/iocoder/yudao/ProjectReactor.java +++ b/yudao-gateway/src/test/java/cn/iocoder/yudao/ProjectReactor.java @@ -66,7 +66,7 @@ public class ProjectReactor { // 写入文件 files.forEach(file -> { // 如果是白名单的文件类型,不进行重写,直接拷贝 - String fileType = FileTypeUtil.getType(file); + String fileType = getFileType(file); if (WHITE_FILE_TYPES.contains(fileType)) { copyFile(file, projectBaseDir, projectBaseDirNew, packageNameNew, artifactIdNew); return; @@ -106,7 +106,7 @@ public class ProjectReactor { String titleNew) { String content = FileUtil.readString(file, StandardCharsets.UTF_8); // 如果是白名单的文件类型,不进行重写 - String fileType = FileTypeUtil.getType(file); + String fileType = getFileType(file); if (WHITE_FILE_TYPES.contains(fileType)) { return content; } @@ -139,4 +139,7 @@ public class ProjectReactor { .replaceAll(StrUtil.upperFirst(ARTIFACT_ID), StrUtil.upperFirst(artifactIdNew)); } + private static String getFileType(File file) { + return file.length() > 0 ? FileTypeUtil.getType(file) : ""; + } }