[Libreoffice-commits] core.git: scripting/java

Stephan Bergmann sbergman at redhat.com
Thu Jul 5 19:59:01 UTC 2018


 scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java |   11 +++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 8b17679fca3564643ff248149e9d9d895e28dda5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jul 5 16:47:00 2018 +0200

    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 at redhat.com>

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); }
+            });
     }
 }


More information about the Libreoffice-commits mailing list