* Always use shared scope for creating streams in serialize() and deserialize().
Fixes http://helma.org/bugs/show_bug.cgi?id=496
This commit is contained in:
parent
fa5430a1d3
commit
2d25df3cbb
1 changed files with 2 additions and 2 deletions
|
@ -587,7 +587,7 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
|
||||||
Object obj = args[0];
|
Object obj = args[0];
|
||||||
File file = new File(Context.toString(args[1])).getAbsoluteFile();
|
File file = new File(Context.toString(args[1])).getAbsoluteFile();
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype();
|
Scriptable scope = RhinoCore.getCore().global;
|
||||||
// use a ScriptableOutputStream that unwraps Wrappers
|
// use a ScriptableOutputStream that unwraps Wrappers
|
||||||
ScriptableOutputStream out = new ScriptableOutputStream(fos, scope) {
|
ScriptableOutputStream out = new ScriptableOutputStream(fos, scope) {
|
||||||
protected Object replaceObject(Object obj) throws IOException {
|
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();
|
File file = new File(Context.toString(args[0])).getAbsoluteFile();
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype();
|
Scriptable scope = RhinoCore.getCore().global;
|
||||||
ObjectInputStream in = new ScriptableInputStream(fis, scope);
|
ObjectInputStream in = new ScriptableInputStream(fis, scope);
|
||||||
Object deserialized = in.readObject();
|
Object deserialized = in.readObject();
|
||||||
in.close();
|
in.close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue