mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
GUAC-969: Fix possible NPE in GuacamoleClassLoader, if the contents of the lib directory cannot be listed.
This commit is contained in:
@@ -105,7 +105,7 @@ public class GuacamoleClassLoader extends ClassLoader {
|
|||||||
|
|
||||||
// Get list of URLs for all .jar's in the lib directory
|
// Get list of URLs for all .jar's in the lib directory
|
||||||
Collection<URL> jarURLs = new ArrayList<URL>();
|
Collection<URL> jarURLs = new ArrayList<URL>();
|
||||||
for (File file : libDirectory.listFiles(new FilenameFilter() {
|
File[] files = libDirectory.listFiles(new FilenameFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File dir, String name) {
|
public boolean accept(File dir, String name) {
|
||||||
@@ -115,13 +115,17 @@ public class GuacamoleClassLoader extends ClassLoader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})) {
|
});
|
||||||
|
|
||||||
|
// Verify directory was successfully read
|
||||||
|
if (files == null)
|
||||||
|
throw new GuacamoleException("Unable to read contents of directory " + libDirectory);
|
||||||
|
|
||||||
|
// Add the URL for each .jar to the jar URL list
|
||||||
|
for (File file : files) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Add URL for the .jar to the jar URL list
|
|
||||||
jarURLs.add(file.toURI().toURL());
|
jarURLs.add(file.toURI().toURL());
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (MalformedURLException e) {
|
catch (MalformedURLException e) {
|
||||||
throw new GuacamoleException(e);
|
throw new GuacamoleException(e);
|
||||||
|
Reference in New Issue
Block a user