Closed Bug 369342 Opened 19 years ago Closed 19 years ago

LazilyLoadedCtor uses Undefined.instance as default value instead of Scriptable.NOT_FOUND

Categories

(Rhino Graveyard :: Core, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: hannesw, Assigned: inonit)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.1.1) Gecko/20060601 Firefox/2.0.0.1 (Ubuntu-edgy) Build Identifier: This bug slipped in with the patch for bug #224334. When LazilyLoadedCtor fails to build the constructor for some reason (for example when the XML constructor can't be created because xbean.jar is not in the classpath), it returns Undefined.instance instead of Scriptable.NOT_FOUND. One place where this causes trouble is in ScriptableOutputStream constructor, which expects standard object names to return either NOT_FOUND, or an instance of Scriptable. java.lang.IllegalArgumentException: Object for excluded name XML is not a Scriptable, it is org.mozilla.javascript.Undefined at org.mozilla.javascript.serialize.ScriptableOutputStream.addOptionalExcludedName(ScriptableOutputStream.java:101) at org.mozilla.javascript.serialize.ScriptableOutputStream.excludeStandardObjectNames(ScriptableOutputStream.java:168) at org.mozilla.javascript.serialize.ScriptableOutputStream.<init>(ScriptableOutputStream.java:84) As far as I can see, the easy fix for this would be to simply return Scriptable.NOT_FOUND instead of Undefined.instance at the very end of LazilyLoadedCtor.buildValue(). Reproducible: Always
I believe I agree. Attila and I are appalled that the fix for bug 224334 swallows all those exceptions, too, and I told him I'd patch it. Thanks for picking this up and I'll try to get a fix on the trunk ASAP.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee: nobody → inonit
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Attached patch Suggested patch? — — Splinter Review
Hannes, is this basically the change you're proposing? I also changed another Undefined.instance to Scriptable.NOT_FOUND for the exception case.
Yes, that's exactly the patch I have in my local copy. Sorry for not posting it.
Committed patch: Checking in LazilyLoadedCtor.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/LazilyLoadedCtor.java,v <-- LazilyLoadedCtor.java new revision: 1.24; previous revision: 1.23 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.6R6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: