Commit 711a2763edc220658ce2609bf6cae5d8e7366a6f
1 parent
640a6023
修复 ProjectReactor 一键改包的报错
Showing
1 changed file
with
6 additions
and
2 deletions
yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java
| ... | ... | @@ -66,7 +66,7 @@ public class ProjectReactor { |
| 66 | 66 | // 写入文件 |
| 67 | 67 | files.forEach(file -> { |
| 68 | 68 | // 如果是白名单的文件类型,不进行重写,直接拷贝 |
| 69 | - String fileType = FileTypeUtil.getType(file); | |
| 69 | + String fileType = getFileType(file); | |
| 70 | 70 | if (WHITE_FILE_TYPES.contains(fileType)) { |
| 71 | 71 | copyFile(file, projectBaseDir, projectBaseDirNew, packageNameNew, artifactIdNew); |
| 72 | 72 | return; |
| ... | ... | @@ -106,7 +106,7 @@ public class ProjectReactor { |
| 106 | 106 | String titleNew) { |
| 107 | 107 | String content = FileUtil.readString(file, StandardCharsets.UTF_8); |
| 108 | 108 | // 如果是白名单的文件类型,不进行重写 |
| 109 | - String fileType = FileTypeUtil.getType(file); | |
| 109 | + String fileType = getFileType(file); | |
| 110 | 110 | if (WHITE_FILE_TYPES.contains(fileType)) { |
| 111 | 111 | return content; |
| 112 | 112 | } |
| ... | ... | @@ -139,4 +139,8 @@ public class ProjectReactor { |
| 139 | 139 | .replaceAll(StrUtil.upperFirst(ARTIFACT_ID), StrUtil.upperFirst(artifactIdNew)); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | + private static String getFileType(File file) { | |
| 143 | + return file.length() > 0 ? FileTypeUtil.getType(file) : ""; | |
| 144 | + } | |
| 145 | + | |
| 142 | 146 | } | ... | ... |