Closed Bug 340682 Opened 19 years ago Closed 19 years ago

E4X Objects not serializable

Categories

(Rhino Graveyard :: E4X, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: randomfletch, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 This bug is related to bug 335992. Running the same test in the shell (i.e. var xml = <xml/>; serialize(xml, "xml.ser"); after the 335992 fix throws a java.io.NotSerializableException: org.mozilla.javascript.xmlimpl.XML$XScriptAnnotation. Reproducible: Always Steps to Reproduce: 1. start up the js shell 2. type: "var xml = <xml/>;" and press enter 3. type: "serialize(xml, "xml.ser");" and press enter Actual Results: org.mozilla.javascript.WrappedException: Wrapped java.io.NotSerializableExceptio n: org.mozilla.javascript.xmlimpl.XML$XScriptAnnotation (<stdin>#3) at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:17 05) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:157) at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:405) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:308 2) at script(<stdin>:3) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.j ava:158) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:3 37) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:275 5) Expected Results: successful serialization of E4X object.
this patch makes XScriptAnnotation serializable which makes the test mentioned in this bug work.
The bigger problem is that Apache XmlBeans is very serialization-unfriendly. XScriptAnnotation extends XmlBookmark which has a field of type XmlMark. The only class implementing XmlMark in XmlBeans is Annotation, and it is not serializable either. So, I think that while this patch will solve this particular problem, sooner or later we'll stumble across another serialization problem that won't be possible to fix within Rhino, but only within XmlBeans...
Committed the fix, with addition of explicit serialVersionUID.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
(In reply to comment #2) > The bigger problem is that Apache XmlBeans is very serialization-unfriendly. > XScriptAnnotation extends XmlBookmark which has a field of type XmlMark. The > only class implementing XmlMark in XmlBeans is Annotation, and it is not > serializable either. So, I think that while this patch will solve this > particular problem, sooner or later we'll stumble across another serialization > problem that won't be possible to fix within Rhino, but only within XmlBeans... Yup. Guess we'll find out if we can deal with them piecemeal or whether some rearchitecting is required. I'm planning to use E4X quite heavily so I'll raise / patch issues as I find them.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: