mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
Extracted URLClassLoader out of try-with-resources block
This commit is contained in:
parent
0c6dd5466c
commit
09e68e7510
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user