Browse Source

REPORT-73403【设计器环境监测】jar异常弹窗,%FR_HOME%\lib和\WEB-INF\lib下的jar需要区分显示

Jar 异常部分处理一下。
feature/x
Harrison 2 years ago
parent
commit
3e054ef021
  1. 18
      designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java

18
designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java vendored

@ -9,12 +9,15 @@ import com.fr.env.detect.bean.ExceptionLog;
import com.fr.env.detect.bean.ExceptionSolution;
import com.fr.env.detect.bean.ExceptionTips;
import com.fr.env.detect.thowable.ThrowableConverter;
import com.fr.stable.EncodeConstants;
import com.fr.stable.resource.ResourceLoader;
import org.jetbrains.annotations.NotNull;
import javax.el.MethodNotFoundException;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
@ -42,6 +45,9 @@ public class ClassConflictConvertor implements ThrowableConverter {
private static final Pattern JAR_NAME_PATTERN = Pattern.compile("([\\w+-\\.]*\\.jar)");
private static final String WEB_INF_STRING = "WEB-INF";
private static final String JAR_URL_SUFFIX = ".jar!";
private static final String JAR_FILE_SUFFIX = ".jar";
private static final String FILE_URL_PREFIX = "file:";
private final Map<Class<?>, ClassNameConverter> throwableMap = new HashMap<>();
@ -101,17 +107,19 @@ public class ClassConflictConvertor implements ThrowableConverter {
}
for (URL url : urlList) {
String file = url.getFile();
Matcher matcher = JAR_NAME_PATTERN.matcher(url.getFile());
if (matcher.find()) {
String jar = matcher.group();
List<String> libPath = null;
String decodeFileStr = URLDecoder.decode(file, EncodeConstants.ENCODING_UTF_8);
if (decodeFileStr.contains(JAR_URL_SUFFIX)) {
String jarPath = decodeFileStr.substring(FILE_URL_PREFIX.length(), decodeFileStr.indexOf(JAR_URL_SUFFIX) + JAR_FILE_SUFFIX.length());
String jar = new File(jarPath).getName();
if (allPath.add(jar)) {
List<String> libPath;
if (file.contains(WEB_INF_STRING)) {
libPath = libMap.get(DetectorConstants.WEB_LIB_PATH);
} else {
libPath = libMap.get(DetectorConstants.FR_HOME_LIB);
}
libPath.add(jar);
allPath.add(jar);
}
}
}
} catch (IOException ignore) {

Loading…
Cancel
Save