From 6ee8026f5a6469ed30e5943ae24d4c1a0c01eacd Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Thu, 17 Aug 2017 15:58:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8F=92=E4=BB=B6EnvVersion=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginHelper.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 1230cbfae6..1b6fde0d7b 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -6,10 +6,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.extra.plugindependence.DownLoadDependenceUI; import com.fr.general.*; import com.fr.general.http.HttpClient; -import com.fr.plugin.Plugin; -import com.fr.plugin.PluginConfigManager; -import com.fr.plugin.PluginLoader; -import com.fr.plugin.PluginManagerHelper; +import com.fr.plugin.*; import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; @@ -268,6 +265,12 @@ public class PluginHelper { FRLogger.getLogger().error(jarExpiredInfo); throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo); } + if (isHigherEnvVersion(plugin.getEnvVersion())) { + String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Jar_Expired", ",", "FR-Designer-Plugin_Install_Failed"}); + FRLogger.getLogger().error(envVersionNotSupport); + throw new com.fr.plugin.PluginVerifyException(envVersionNotSupport); + } + File fileToCheck = getTempPluginFileDirectory(); File oldfile = new File(StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), ProjectConstants.PLUGINS_NAME, "plugin-" + plugin.getId())); if (!PluginManagerHelper.checkLic(plugin, fileToCheck)) { @@ -278,7 +281,12 @@ public class PluginHelper { } } } - + + private static boolean isHigherEnvVersion(String envVersion) { + //高于8.0 + return PluginUtils.compareVersion(envVersion, "8.0") > 0; + } + /** * 获取插件解压的临时文件夹 * From da225f08dba82f4ea3af0113a4e57a9ef28dec0d Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Thu, 17 Aug 2017 16:11:57 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8F=92=E4=BB=B6EnvVersion=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/extra/PluginHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 1b6fde0d7b..798b732947 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -266,7 +266,7 @@ public class PluginHelper { throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo); } if (isHigherEnvVersion(plugin.getEnvVersion())) { - String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Jar_Expired", ",", "FR-Designer-Plugin_Install_Failed"}); + String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Env_Expired", ",", "FR-Designer-Plugin_Install_Failed"}); FRLogger.getLogger().error(envVersionNotSupport); throw new com.fr.plugin.PluginVerifyException(envVersionNotSupport); } From 3d8723c9fd26d9b2819623368838ad8001f80781 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Thu, 17 Aug 2017 17:22:51 +0800 Subject: [PATCH 3/3] pmd --- .../src/com/fr/design/extra/PluginHelper.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 798b732947..613d887e71 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -4,9 +4,17 @@ import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.extra.plugindependence.DownLoadDependenceUI; -import com.fr.general.*; +import com.fr.general.FRLogger; +import com.fr.general.GeneralUtils; +import com.fr.general.IOUtils; +import com.fr.general.Inter; +import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; -import com.fr.plugin.*; +import com.fr.plugin.Plugin; +import com.fr.plugin.PluginConfigManager; +import com.fr.plugin.PluginLoader; +import com.fr.plugin.PluginManagerHelper; +import com.fr.plugin.PluginUtils; import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; @@ -112,8 +120,8 @@ public class PluginHelper { */ public static Plugin readPlugin(File chosenFile) throws Exception { // 需要先删除临时目录保证加压出来的文件不会和安装失败的文件混合到一起 - StableUtils.deleteFile(new File(TEMP_PATH)); - + StableUtils.deleteFile(new File(TEMP_PATH)) + IOUtils.unzip(chosenFile, TEMP_PATH); File pluginFileDir = getTempPluginFileDirectory(); if (pluginFileDir == null) {