cid#1437407: create class loader in doPrivileged

Change-Id: Iade079e44c8d88a13830258157d9481f4b8b3358
Reviewed-on: https://gerrit.libreoffice.org/57013
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2018-07-05 16:47:00 +02:00
parent f73eeabf6e
commit 8b17679fca

View file

@ -23,6 +23,8 @@ import com.sun.star.script.framework.log.LogUtils;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* Class Loader Factory
@ -43,8 +45,11 @@ public class ClassLoaderFactory {
return getURLClassLoader(parent, classPath);
}
public static ClassLoader getURLClassLoader(ClassLoader parent,
URL[] classpath) {
return new URLClassLoader(classpath, parent);
public static ClassLoader getURLClassLoader(final ClassLoader parent,
final URL[] classpath) {
return AccessController.doPrivileged(
new PrivilegedAction<URLClassLoader>() {
public URLClassLoader run() { return new URLClassLoader(classpath, parent); }
});
}
}