serialize issue while using ObjectUtil.copy

87 views
Skip to first unread message

tempjoy

unread,
May 21, 2011, 3:22:09 AM5/21/11
to FxWorks, tem...@gmail.com
Hello FlexXB Team,


I have been using the recent version of FlexXB and am facing an issue
while serializing the objects created with ObjectUtil.copy method.

1. This is the serialize call for normal flex object.
FlexXBEngine.instance.serialize(actionObj));

2. Result of step no.1 (working well)
<action>
<actnDesc>testdesc</actnDesc>
<reasonCodeList/>
</action>

3. serialize call using replicated object created with ObjectUtil.copy
FlexXBEngine.instance.serialize(ObjectUtil.copy(actionObj)));

4. Result of step 3.
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at com.googlecode.flexxb.core::SerializationCore/serialize()
at FlexXBCore/serialize()
at com.googlecode.flexxb::FlexXBEngine/serialize()

Please reply me what would be the possible solution for this issue.

Thanks in Advance.

Alexutz

unread,
May 21, 2011, 11:43:51 AM5/21/11
to FxWorks
Hmm, that's weird. I'll do a test and get back to you
Message has been deleted

Alexutz

unread,
May 21, 2011, 5:02:19 PM5/21/11
to FxWorks
The problem comes from the fact that ObjectUtil.copy returns an
untyped object instance. You should call register class alias for all
classes involved in the copy process. Just use
registerClassAlias("com.type.Type", Type) for each type before calling
the copy method.
> > Thanks in Advance.- Ascundeţi textul citat -
>
> - Afişare text în citat -

Yonas

unread,
May 21, 2011, 6:17:47 PM5/21/11
to FxWorks
You can also use the metadata tag [RemoteClass]. This basically
achieves the same thing as calling registerClassAlias().
You can then use the tag [Transient] on properties you don't want
copied across when you call ObjectUtil.copy()
> > > Thanks in Advance.- Ascundeþi textul citat -
>
> > - Afiºare text în citat -

Joy

unread,
May 23, 2011, 7:48:30 AM5/23/11
to FxWorks
Great. Both solutions worked for me.

Thanks for the reply.
> > > - Afiºare text în citat -- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages