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:
parent
0b6e43fd10
commit
31044cc2db
|
@ -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};
|
||||
|
|
Loading…
Reference in New Issue