fix(测试跟踪): 加载插件时,插件类型选择错误,导致平台插件功能异常

--bug=1025843 --user=陈建星 【系统设置】第三方平台插件上传-使用场景选择错误后修正上传成功,服务集成中测试连接失败 https://www.tapd.cn/55049933/s/1369137
--bug=1025997 --user=陈建星 【测试跟踪】项目集成jira-输入key-点击检查报500 https://www.tapd.cn/55049933/s/1369138
This commit is contained in:
chenjianxing 2023-05-05 19:03:34 +08:00 committed by jianxing
parent 0b6e43fd10
commit 31044cc2db
1 changed files with 7 additions and 2 deletions

View File

@ -64,7 +64,6 @@ public class ApiPluginService {
}
private boolean loadJar(String jarPath) {
validatePluginType(jarPath);
try {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
try {
@ -93,19 +92,25 @@ public class ApiPluginService {
* @param jarPath
*/
private void validatePluginType(String jarPath) {
boolean valid = true;
try {
JarFile jar = new JarFile(jarPath);
JarEntry entry = jar.getJarEntry("json/frontend.json");
if (entry != null) {
MSException.throwException(Translator.get("plugin_type_error"));
// 如果 jar 包中包含 frontend.json 文件说明是平台插件
valid = false;
}
} catch (Exception e) {
LogUtil.error(e);
}
if (!valid) {
MSException.throwException(Translator.get("plugin_type_error"));
}
}
private List<PluginResourceDTO> getMethod(String path, String fileName) {
List<PluginResourceDTO> resources = new LinkedList<>();
validatePluginType(path);
try {
this.loadJar(path);
String jarPath[] = new String[]{path};