users@jaxb.java.net

Re: JAXBElement: afterUnmarshal callback parent incorrect

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Wed, 29 Sep 2010 15:11:25 +0200

Hmm, do you think that "tree climbing" could be achieved if you do get
the real XML parent? Reading the Javadoc of afterUnmarshal indicates two
serious obstacles: IDREFs aren't expanded yet, and the child isn't set into
its parent.

Possibly you have raised a valid point - but I'd say for the wrong reason?!

-W


On 29 September 2010 03:09, Jason Harrop <jason_at_plutext.org> wrote:
> Hi guys
>
> If finding that if an XML element unmarshalls as a JAXBElement, then
> in the afterUnmarshal callback for the relevant class, the parent
> passed in is wrong.
>
> The parent should be, well, the parent.  Instead, it is a JAXBElement
> (which wraps a copy of the child).  The result is that you can't climb
> the tree from anything wrapped in a JAXBElement.
>
> I did log this with Oracle a week ago, but haven't heard anything back.
>
> Thoughts (apart from providing a test case)?
>
> .. Jason
>
>
>
>
> ---------- Forwarded message ----------
> From: IncidentDaemon_at_sun.com <IncidentDaemon_at_sun.com>
> Date: Tue, Sep 21, 2010 at 3:13 PM
> Subject: Your Report (Review ID: 1874905) - JAXB 2.x afterUnmarshal
> callback parent incorrect
> To: jason_at_plutext.org
>
>
>
> ---------------------------------------------------------------
>
>
> Date Created: Mon Sep 20 23:13:14 MDT 2010
> Type:        bug
> Customer Name:   Jason Harrop
> Customer Email:  jason_at_plutext.org
> SDN ID:
> status:      Waiting
> Category:    jaxb-xsd
> Subcategory: runtime
> Company:     Plutext
> release:     1.0.4
> hardware:    x64
> OSversion:   windows_7
> priority:    4
> Synopsis:    JAXB 2.x afterUnmarshal callback parent incorrect
> Description:
>  FULL PRODUCT VERSION :
> JAXB 2.x
>
> ADDITIONAL OS VERSION INFORMATION :
> All os
>
> EXTRA RELEVANT SYSTEM CONFIGURATION :
> irrelevant
>
> A DESCRIPTION OF THE PROBLEM :
> If an element unmarshalls as a JAXBElement, then in the afterUnmarshal
> callback, the parent passed in is wrong.
>
> The parent should be the parent.  Instead, it is a JAXBElement which
> looks like the child.
>
> STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
> Unmarshall something which results in a JAXBElement, and look at its
> parent by implementing the afterUnmarshall callback..
>
> EXPECTED VERSUS ACTUAL BEHAVIOR :
> EXPECTED -
> Expected the parent value to match the parent XML node.
> ACTUAL -
> The parent value matched the child.
>
> REPRODUCIBILITY :
> This bug can be reproduced always.
> workaround:
> comments:    (company - Plutext , email - jason_at_plutext.org)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>