mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
try url class loader
This commit is contained in:
@@ -39,6 +39,9 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
@@ -334,7 +337,26 @@ public class TestAll implements Test {
|
||||
return testRoots.split(";");
|
||||
}
|
||||
final String[] roots = ExternalClasspathClassLoader.getRoots();
|
||||
return roots != null ? roots : System.getProperty("java.class.path").split(File.pathSeparator);
|
||||
if (roots != null) {
|
||||
return roots;
|
||||
}
|
||||
else {
|
||||
final ClassLoader loader = TestAll.class.getClassLoader();
|
||||
if (loader instanceof URLClassLoader) {
|
||||
final URL[] urls = ((URLClassLoader)loader).getURLs();
|
||||
final String[] urlsStrings = new String[urls.length];
|
||||
for (int i = 0; i < urls.length; i++) {
|
||||
try {
|
||||
urlsStrings[i] = urls[i].toURI().toString();
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return urlsStrings;
|
||||
}
|
||||
return System.getProperty("java.class.path").split(File.pathSeparator);
|
||||
}
|
||||
}
|
||||
|
||||
public TestAll(String packageRoot) throws Throwable {
|
||||
|
||||
Reference in New Issue
Block a user