Skip to content

Commit

Permalink
add another try-with-resource to fix missing close introduced in last…
Browse files Browse the repository at this point in the history
… commit
  • Loading branch information
rbri committed Feb 24, 2024
1 parent 5953334 commit ba08398
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions toolsrc/org/mozilla/javascript/tools/shell/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,10 @@ public static Object deserialize(Context cx, Scriptable thisObj, Object[] args,
String filename = Context.toString(args[0]);
try (FileInputStream fis = new FileInputStream(filename)) {
Scriptable scope = ScriptableObject.getTopLevelScope(thisObj);
ObjectInputStream in = new ScriptableInputStream(fis, scope);
Object deserialized = in.readObject();
return Context.toObject(deserialized, scope);
try (ObjectInputStream in = new ScriptableInputStream(fis, scope)) {
Object deserialized = in.readObject();
return Context.toObject(deserialized, scope);
}
}
}

Expand Down

0 comments on commit ba08398

Please sign in to comment.