ClassLoader->URLClassLoader
Change-Id: I1f46a99025ba33d08842da9b06611dcfa6b1b49c Reviewed-on: https://gerrit.libreoffice.org/29474 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -31,7 +31,7 @@ public class ClassLoaderFactory {
|
||||
|
||||
private ClassLoaderFactory() {}
|
||||
|
||||
public static ClassLoader getURLClassLoader(ScriptMetaData scriptData) {
|
||||
public static URLClassLoader getURLClassLoader(ScriptMetaData scriptData) {
|
||||
ClassLoader parent = scriptData.getClass().getClassLoader();
|
||||
URL[] classPath = scriptData.getClassPath();
|
||||
LogUtils.DEBUG("Classpath has length " + classPath.length);
|
||||
@@ -43,8 +43,8 @@ public class ClassLoaderFactory {
|
||||
return getURLClassLoader(parent, classPath);
|
||||
}
|
||||
|
||||
private static ClassLoader getURLClassLoader(ClassLoader parent,
|
||||
private static URLClassLoader getURLClassLoader(ClassLoader parent,
|
||||
URL[] classpath) {
|
||||
return new URLClassLoader(classpath, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -181,14 +182,14 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
|
||||
public void edit(final XScriptContext context, ScriptMetaData entry) {
|
||||
if (entry != null) {
|
||||
try {
|
||||
ClassLoader cl = null;
|
||||
URLClassLoader cl = null;
|
||||
|
||||
try {
|
||||
cl = ClassLoaderFactory.getURLClassLoader(entry);
|
||||
} catch (Exception ignore) { // TODO re-examine error handling
|
||||
}
|
||||
|
||||
final ClassLoader theCl = cl;
|
||||
final URLClassLoader theCl = cl;
|
||||
final URL url = entry.getSourceURL();
|
||||
SwingInvocation.invoke(
|
||||
new Runnable() {
|
||||
|
@@ -50,6 +50,7 @@ import com.sun.star.uno.Type;
|
||||
import com.sun.star.uno.XComponentContext;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
@@ -182,7 +183,7 @@ class ScriptImpl implements XScript {
|
||||
aOutParamIndex[0] = new short[0];
|
||||
aOutParam[0] = new Object[0];
|
||||
|
||||
ClassLoader cl = null;
|
||||
URLClassLoader cl = null;
|
||||
URL sourceUrl = null;
|
||||
|
||||
try {
|
||||
|
@@ -45,6 +45,7 @@ import com.sun.star.script.provider.XScript;
|
||||
import com.sun.star.uno.XComponentContext;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import org.mozilla.javascript.Context;
|
||||
import org.mozilla.javascript.ImporterTopLevel;
|
||||
@@ -181,7 +182,7 @@ class ScriptImpl implements XScript {
|
||||
aOutParamIndex[0] = new short[0];
|
||||
aOutParam[0] = new Object[0];
|
||||
|
||||
ClassLoader cl = null;
|
||||
URLClassLoader cl = null;
|
||||
|
||||
try {
|
||||
cl = ClassLoaderFactory.getURLClassLoader(metaData);
|
||||
|
Reference in New Issue
Block a user