diff options
Diffstat (limited to 'scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java index c832e6ed691f..b444cce8e46f 100644 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java @@ -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; @@ -180,15 +181,14 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener { */ public void edit(final XScriptContext context, ScriptMetaData entry) { if (entry != null) { + URLClassLoader cl = null; try { - ClassLoader 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() { @@ -210,6 +210,12 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener { }); } catch (IOException ioe) { showErrorMessage("Error loading file: " + ioe.getMessage()); + if (cl != null) { + try { + cl.close(); + } catch (IOException e) { + } + } } } } |