Browse Source

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

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

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

Loading…
Cancel
Save