|
|
|
@ -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; |
|
|
|
|
if (file.contains(WEB_INF_STRING)) { |
|
|
|
|
libPath = libMap.get(DetectorConstants.WEB_LIB_PATH); |
|
|
|
|
} else { |
|
|
|
|
libPath = libMap.get(DetectorConstants.FR_HOME_LIB); |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
libPath.add(jar); |
|
|
|
|
allPath.add(jar); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (IOException ignore) { |
|
|
|
|