dengzedong
2024-09-29 3009e26a956e2f4451d79e2e63edad3d9e401b70
异常处理
已修改1个文件
50 ■■■■■ 文件已修改
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
@@ -270,7 +270,11 @@
        generatorCodeHistoryService.insert(historyEntity);
        // 删除临时文件
        FileUtils.deleteDirectory(dirPath);
        try {
            FileUtils.deleteDirectory(dirPath);
        } catch (IOException e) {
            throw new RuntimeException("删除临时文件异常");
        }
        return bytes;
    }
@@ -476,16 +480,20 @@
        GenUtils.drawTemplate("log.txt.vm", data, logFile);
    }
    private String pkgJar(String dirPath) throws InterruptedException {
        String jarSavePath = dirPath + File.separator + MdkConstant.LIBS + File.separator + "IAILMDK.jar";
        StringBuilder sb = new StringBuilder();
        sb.append("jar -cvf");
        sb.append(" ").append(jarSavePath);
        sb.append(" -C ").append(dirPath).append(File.separator).append("IAILMDK").append(File.separator).append(" .");
        log.info("执行cmd命令打jar包:" + sb);
        Process process = RuntimeUtil.exec(sb.toString());
        process.waitFor();
        return jarSavePath;
    private String pkgJar(String dirPath) {
        try {
            String jarSavePath = dirPath + File.separator + MdkConstant.LIBS + File.separator + "IAILMDK.jar";
            StringBuilder sb = new StringBuilder();
            sb.append("jar -cvf");
            sb.append(" ").append(jarSavePath);
            sb.append(" -C ").append(dirPath).append(File.separator).append("IAILMDK").append(File.separator).append(" .");
            log.info("执行cmd命令打jar包:" + sb);
            Process process = RuntimeUtil.exec(sb.toString());
            process.waitFor();
            return jarSavePath;
        } catch (InterruptedException e) {
            throw new RuntimeException("执行cmd命令打jar包异常");
        }
    }
    private void deleteJavaFile(List<String> javaFilePaths) {
@@ -494,14 +502,18 @@
        }
    }
    private void createClassFile(List<String> javaFilePaths) throws InterruptedException {
        StringBuilder sb = new StringBuilder();
        sb.append("javac -encoding utf-8");
        for (String path : javaFilePaths) {
            sb.append(" ").append(path);
    private void createClassFile(List<String> javaFilePaths){
        try {
            StringBuilder sb = new StringBuilder();
            sb.append("javac -encoding utf-8");
            for (String path : javaFilePaths) {
                sb.append(" ").append(path);
            }
            log.info("执行cmd命令生成class:" + sb);
            Process process = RuntimeUtil.exec(sb.toString());
            process.waitFor();
        } catch (InterruptedException e) {
            throw new RuntimeException("执行cmd命令生成class异常");
        }
        log.info("执行cmd命令生成class:" + sb);
        Process process = RuntimeUtil.exec(sb.toString());
        process.waitFor();
    }
}