cid#1326721 to cid#1326726 Dm: Dubious method used

Change-Id: I98e5590f61434ed1b1081b5b592622f9bcf037ec
This commit is contained in:
Noel Grandin
2015-10-16 11:52:41 +02:00
parent 84ec34e08e
commit a2fa0ded8a

View File

@@ -59,9 +59,9 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
// global ScriptEditorForBeanShell returned for getEditor() calls // global ScriptEditorForBeanShell returned for getEditor() calls
private static ScriptEditorForBeanShell theScriptEditorForBeanShell; private static ScriptEditorForBeanShell theScriptEditorForBeanShell;
// global list of ScriptEditors, key is URL of file being edited // global list of ScriptEditors, key is [external form of URL] of file being edited
private static Map<URL, ScriptEditorForBeanShell> BEING_EDITED = private static Map<String, ScriptEditorForBeanShell> BEING_EDITED =
new HashMap<URL, ScriptEditorForBeanShell>(); new HashMap<String, ScriptEditorForBeanShell>();
// template for new BeanShell scripts // template for new BeanShell scripts
private static String BSHTEMPLATE; private static String BSHTEMPLATE;
@@ -112,7 +112,7 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
*/ */
public static ScriptEditorForBeanShell getEditor(URL url) { public static ScriptEditorForBeanShell getEditor(URL url) {
synchronized (BEING_EDITED) { synchronized (BEING_EDITED) {
return BEING_EDITED.get(url); return BEING_EDITED.get(url.toExternalForm());
} }
} }
@@ -194,12 +194,12 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
ScriptEditorForBeanShell editor; ScriptEditorForBeanShell editor;
synchronized (BEING_EDITED) { synchronized (BEING_EDITED) {
editor = BEING_EDITED.get(url); editor = BEING_EDITED.get(url.toExternalForm());
if (editor == null) { if (editor == null) {
editor = new ScriptEditorForBeanShell( editor = new ScriptEditorForBeanShell(
context, theCl, url); context, theCl, url);
BEING_EDITED.put(url, editor); BEING_EDITED.put(url.toExternalForm(), editor);
} }
} }
@@ -353,7 +353,7 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
private void shutdown() { private void shutdown() {
synchronized (BEING_EDITED) { synchronized (BEING_EDITED) {
BEING_EDITED.remove(scriptURL); BEING_EDITED.remove(scriptURL.toExternalForm());
} }
} }