I've been digging some more and it looks like the problem is in the Jettison
code base.  Line 285 of the
org.codehaus.jettison.mapped.MappedXMLStreamWriter class is hardcoded to
check check for a stack bigger than three which means that anytime you have
a parent class that has a property of the same name as one of it's children
we get a clash.  This code really needs to track a depth as well so it can
keep the two namespaces seperate when it does the serialization.  I guess
this is more of a Jettison issue that CXF issue.  I'll post something over
there.

Stephen

On Wed, Aug 12, 2009 at 9:40 AM, Stephen Lynn <[email protected]> wrote:

> I'm trying to serialize an object tree that looks something like this:
>
> - owners
>     - date
>     - collections (list of collection objects)
>         - filter
>         - videos (list of video objects)
>             - filter
>
> So the tree has a list of "Collection" objects and each collection has a
> list of "Video" objects.  Both Collection and Video objects contain a Filter
> object which is what causes the problem in the JSON serialization.  If I
> rename the filter variable in Video to "videoFilter" (or anything different
> than "filter") then serialization works fine but if both objects have a
> child with the same name then things get all mixed up.
>
> By mixed up I mean I get a valid JSON object back but the tree is all
> rearranged so that pieces a Collection object appear at the root of the tree
> and nothing is in the proper place.
>
> Has anyone else seen this problem?  Are there any fixes/workarounds other
> than renaming properties?
>
> Thanks,
>
> Stephen
>

Reply via email to