Merge pull request #649 from Vshnv/patch/expansion-classloader
Fixed issue with expansions not being able to access their resources
This commit is contained in:
commit
8c69a164b8
|
@ -42,13 +42,11 @@ public class FileUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
final URL jar = file.toURI().toURL();
|
final URL jar = file.toURI().toURL();
|
||||||
|
final URLClassLoader loader = new URLClassLoader(new URL[]{jar}, clazz.getClassLoader());
|
||||||
final List<String> matches = new ArrayList<>();
|
final List<String> matches = new ArrayList<>();
|
||||||
final List<Class<? extends T>> classes = new ArrayList<>();
|
final List<Class<? extends T>> classes = new ArrayList<>();
|
||||||
|
|
||||||
try (final JarInputStream stream = new JarInputStream(
|
try (final JarInputStream stream = new JarInputStream(jar.openStream())) {
|
||||||
jar.openStream()); final URLClassLoader loader = new URLClassLoader(new URL[]{jar},
|
|
||||||
clazz.getClassLoader())) {
|
|
||||||
JarEntry entry;
|
JarEntry entry;
|
||||||
while ((entry = stream.getNextJarEntry()) != null) {
|
while ((entry = stream.getNextJarEntry()) != null) {
|
||||||
final String name = entry.getName();
|
final String name = entry.getName();
|
||||||
|
@ -69,8 +67,11 @@ public class FileUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (classes.isEmpty()) {
|
||||||
return classes.isEmpty() ? null : classes.get(0);
|
loader.close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return classes.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue