From 21116c4e55b9fdf1165ae70f98d9213ee739939f Mon Sep 17 00:00:00 2001 From: "szegedia%freemail.hu" Date: Fri, 3 Feb 2006 11:07:32 +0000 Subject: [PATCH] Fix for bug #323054: nonexisting optional standard objects like XML don't cause ObjectOutputStream to throw an exception anymore. --- .../serialize/ScriptableOutputStream.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/js/rhino/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java b/js/rhino/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java index 74786409fd04..20c73dd81431 100644 --- a/js/rhino/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java +++ b/js/rhino/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java @@ -83,15 +83,22 @@ public class ScriptableOutputStream extends ObjectOutputStream { * serialization. Names excluded from serialization are looked up * in the new scope and replaced upon deserialization. * @param name a fully qualified name (of the form "a.b.c", where - * "a" must be a property of the top-level object) + * "a" must be a property of the top-level object). If it does + * not exist, it is ignored. + * @throws IllegalArgumentException if the object with the specified name is + * not a Scriptable. */ public void addExcludedName(String name) { Object obj = lookupQualifiedName(scope, name); - if (!(obj instanceof Scriptable)) { - throw new IllegalArgumentException("Object for excluded name " + - name + " not found."); + if(obj != null) { + if (!(obj instanceof Scriptable)) { + throw new IllegalArgumentException( + "Object for excluded name " + name + + " is not a Scriptable, it is a " + + obj.getClass().getName()); + } + table.put(obj, name); } - table.put(obj, name); } /**