Browse Source

Merge pull request #10319 in DESIGN/design from final/11.0 to release/11.0

* commit '23bd6e39a449151b4eb3131895bcfeef1c023a37':
  REPORT-76857 云端运维插件也会被环境检测检测到 删掉一个单元测试。依赖于环境,不稳定
  REPORT-76857 云端运维插件也会被环境检测检测到 只检测 web-inf/lib 和 designer/lib 下面的。 忽视插件
release/11.0
superman 2 years ago
parent
commit
677526ad71
  1. 4
      designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java
  2. 12
      designer-base/src/test/java/com/fr/env/detect/impl/converter/ClassConflictConvertorTest.java

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

@ -48,6 +48,7 @@ public class ClassConflictConvertor implements ThrowableConverter {
private static final String JAR_URL_SUFFIX = ".jar!"; private static final String JAR_URL_SUFFIX = ".jar!";
private static final String JAR_FILE_SUFFIX = ".jar"; private static final String JAR_FILE_SUFFIX = ".jar";
private static final String FILE_URL_PREFIX = "file:"; private static final String FILE_URL_PREFIX = "file:";
private static final String PLUGINS_DIR_NAME = "plugins";
private final Map<Class<?>, ClassNameConverter> throwableMap = new HashMap<>(); private final Map<Class<?>, ClassNameConverter> throwableMap = new HashMap<>();
@ -108,6 +109,9 @@ public class ClassConflictConvertor implements ThrowableConverter {
for (URL url : urlList) { for (URL url : urlList) {
String file = url.getFile(); String file = url.getFile();
String decodeFileStr = URLDecoder.decode(file, EncodeConstants.ENCODING_UTF_8); String decodeFileStr = URLDecoder.decode(file, EncodeConstants.ENCODING_UTF_8);
if (decodeFileStr.contains(PLUGINS_DIR_NAME)) {
continue;
}
if (decodeFileStr.contains(JAR_URL_SUFFIX)) { if (decodeFileStr.contains(JAR_URL_SUFFIX)) {
String jarPath = decodeFileStr.substring(FILE_URL_PREFIX.length(), decodeFileStr.indexOf(JAR_URL_SUFFIX) + JAR_FILE_SUFFIX.length()); String jarPath = decodeFileStr.substring(FILE_URL_PREFIX.length(), decodeFileStr.indexOf(JAR_URL_SUFFIX) + JAR_FILE_SUFFIX.length());
String jar = new File(jarPath).getName(); String jar = new File(jarPath).getName();

12
designer-base/src/test/java/com/fr/env/detect/impl/converter/ClassConflictConvertorTest.java vendored

@ -1,5 +1,6 @@
package com.fr.env.detect.impl.converter; package com.fr.env.detect.impl.converter;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class ClassConflictConvertorTest { public class ClassConflictConvertorTest {
@ -10,14 +11,7 @@ public class ClassConflictConvertorTest {
ClassNotFoundException ex1 = new ClassNotFoundException("Class 111.222.333 not found"); ClassNotFoundException ex1 = new ClassNotFoundException("Class 111.222.333 not found");
Iterable<String> names = ClassConflictConvertor.Converter.CLASS.converter(ex1); Iterable<String> names = ClassConflictConvertor.Converter.CLASS.converter(ex1);
System.out.println(); String next = names.iterator().next();
} Assert.assertEquals("111.222.333", next);
@Test
public void testConverter() {
ClassNotFoundException ex1 = new ClassNotFoundException("com.zaxxer.hikari.HikariConfig");
ClassConflictConvertor convertor = new ClassConflictConvertor();
convertor.convert(ex1);
} }
} }
Loading…
Cancel
Save