From 2d25df3cbb67e2b604526102a4d354a9088c726f Mon Sep 17 00:00:00 2001 From: hns Date: Mon, 12 Feb 2007 13:15:09 +0000 Subject: [PATCH] * Always use shared scope for creating streams in serialize() and deserialize(). Fixes http://helma.org/bugs/show_bug.cgi?id=496 --- src/helma/scripting/rhino/GlobalObject.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helma/scripting/rhino/GlobalObject.java b/src/helma/scripting/rhino/GlobalObject.java index a618eceb..0aca4cd0 100644 --- a/src/helma/scripting/rhino/GlobalObject.java +++ b/src/helma/scripting/rhino/GlobalObject.java @@ -587,7 +587,7 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder { Object obj = args[0]; File file = new File(Context.toString(args[1])).getAbsoluteFile(); FileOutputStream fos = new FileOutputStream(file); - Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype(); + Scriptable scope = RhinoCore.getCore().global; // use a ScriptableOutputStream that unwraps Wrappers ScriptableOutputStream out = new ScriptableOutputStream(fos, scope) { protected Object replaceObject(Object obj) throws IOException { @@ -613,7 +613,7 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder { } File file = new File(Context.toString(args[0])).getAbsoluteFile(); FileInputStream fis = new FileInputStream(file); - Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype(); + Scriptable scope = RhinoCore.getCore().global; ObjectInputStream in = new ScriptableInputStream(fis, scope); Object deserialized = in.readObject(); in.close();