summaryrefslogtreecommitdiff
path: root/ridljar
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2007-03-14 07:35:06 +0000
committerOliver Bolte <obo@openoffice.org>2007-03-14 07:35:06 +0000
commit91cabfcd165312a570a74697945e2b11926a830a (patch)
treec72285ba34175378c67115f45c3c236e0827e6ce /ridljar
parent66b36453a261c0352f5756cec9d0a9d7618830aa (diff)
INTEGRATION: CWS sb69 (1.4.24); FILE MERGED
2007/01/25 13:25:22 sb 1.4.24.1: #i72612# Creating a class loader should be done priviliged.
Diffstat (limited to 'ridljar')
-rw-r--r--ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoLoader.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoLoader.java b/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoLoader.java
index d1edcd9c803c..cb7dffe2d7d8 100644
--- a/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoLoader.java
+++ b/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoLoader.java
@@ -4,9 +4,9 @@
*
* $RCSfile: UnoLoader.java,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: obo $ $Date: 2007-03-12 10:48:53 $
+ * last change: $Author: obo $ $Date: 2007-03-14 08:35:06 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -37,7 +37,11 @@ package com.sun.star.lib.unoloader;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
/**
* A helper class for executing UNO JARs.
@@ -75,12 +79,23 @@ public final class UnoLoader {
* the <code>main</code> method of the specified Main-Class of the given JAR
* <code>jar</code>.
*/
- public static void execute(URL base, URL jar, String[] arguments)
+ public static void execute(final URL base, URL jar, String[] arguments)
throws IOException, ClassNotFoundException, NoSuchMethodException,
InvocationTargetException
{
- new UnoClassLoader(base, null, UnoLoader.class.getClassLoader()).
- execute(jar, arguments);
+ UnoClassLoader cl;
+ try {
+ cl = (UnoClassLoader) AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Object run() throws MalformedURLException {
+ return new UnoClassLoader(
+ base, UnoLoader.class.getClassLoader());
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (MalformedURLException) e.getException();
+ }
+ cl.execute(jar, arguments);
}
private UnoLoader() {}