GUACAMOLE-1508: Merge ensure extension JarFile is always properly closed.

This commit is contained in:
Virtually Nick
2022-01-23 19:14:13 -05:00
committed by GitHub

View File

@@ -216,14 +216,7 @@ public class ExtensionClassLoader extends URLClassLoader {
private static URL[] getExtensionURLs(File extension,
List<File> temporaryFiles) throws GuacamoleException {
JarFile extensionJar;
try {
extensionJar = new JarFile(extension);
}
catch (IOException e) {
throw new GuacamoleServerException("Contents of extension \""
+ extension + "\" cannot be read.", e);
}
try (JarFile extensionJar = new JarFile(extension)) {
// Include extension itself within classpath
List<URL> urls = new ArrayList<>();
@@ -296,6 +289,12 @@ public class ExtensionClassLoader extends URLClassLoader {
return urls.toArray(new URL[0]);
}
catch (IOException e) {
throw new GuacamoleServerException("Contents of extension \""
+ extension + "\" cannot be read.", e);
}
}
/**