From e39ee7844f8c301652e55ac05fa273509647a4f1 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 20 Jun 2022 17:18:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8F=92=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/service/sys/PluginService.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/sys/PluginService.java b/backend/src/main/java/io/dataease/service/sys/PluginService.java index 2fa937a64e..6f8b118046 100644 --- a/backend/src/main/java/io/dataease/service/sys/PluginService.java +++ b/backend/src/main/java/io/dataease/service/sys/PluginService.java @@ -11,14 +11,12 @@ import io.dataease.commons.exception.DEException; import io.dataease.commons.utils.CodingUtil; import io.dataease.commons.utils.DeFileUtils; import io.dataease.commons.utils.LogUtil; -import io.dataease.commons.utils.ZipUtils; import io.dataease.controller.sys.base.BaseGridRequest; import io.dataease.i18n.Translator; import io.dataease.listener.util.CacheUtils; import io.dataease.plugins.common.base.domain.MyPlugin; import io.dataease.plugins.common.base.mapper.MyPluginMapper; import io.dataease.plugins.config.LoadjarUtil; -import io.dataease.plugins.config.SpringContextUtil; import io.dataease.service.datasource.DatasourceService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ArrayUtils; @@ -31,7 +29,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.File; -import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.List; @@ -98,14 +95,14 @@ public class PluginService { DeFileUtils.deleteFile(folder); String msg = "缺少插件描述文件【plugin.json】"; LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } MyPluginDTO myPlugin = formatJsonFile(jsonFiles[0]); if (!versionMatch(myPlugin.getRequire())) { String msg = "当前插件要求系统版本最低为:" + myPlugin.getRequire(); LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } //4.加载jar包 失败则 直接返回错误 删除文件 File[] jarFiles = folderFile.listFiles(this::isPluginJar); @@ -114,13 +111,13 @@ public class PluginService { DeFileUtils.deleteFile(folder); String msg = "缺少插件jar文件"; LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } if (pluginExist(myPlugin)) { String msg = "插件【"+myPlugin.getName()+"】已存在,请先卸载"; LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } String targetDir = null; try { @@ -188,7 +185,7 @@ public class PluginService { if (ObjectUtils.isEmpty(myPlugin)) { String msg = "当前插件不存在"; LogUtil.error(msg); - DEException.throwException(new RuntimeException(msg)); + DEException.throwException(msg); } deleteJarFile(myPlugin); CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME); @@ -197,7 +194,7 @@ public class PluginService { if(myPlugin.getCategory().equalsIgnoreCase("datasource")){ if(CollectionUtils.isNotEmpty(datasourceService.selectByType(myPlugin.getDsType()))){ - throw new RuntimeException(Translator.get("i18n_plugin_not_allow_delete")); + DEException.throwException(Translator.get("i18n_plugin_not_allow_delete")); } loadjarUtil.deleteModule(myPlugin.getModuleName() + "-" + myPlugin.getVersion()); }