summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-07-05 16:47:00 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-07-05 21:58:34 +0200
commit8b17679fca3564643ff248149e9d9d895e28dda5 (patch)
treed02be8df80af67da0223d516e83981bbc8e99d71 /scripting
parentf73eeabf6e584e4a1414ecb0878bb46143f90ff5 (diff)
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>
Diffstat (limited to 'scripting')
-rw-r--r--scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java b/scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java
index 5434945ed41e..b5e6e3085bd2 100644
--- a/scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java
+++ b/scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java
@@ -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); }
+ });
}
}