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@sun.com <IncidentDaemon@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@plutext.org---------------------------------------------------------------
Date Created: Mon Sep 20 23:13:14 MDT 2010
Type: bug
Customer Name: Jason Harrop
Customer Email:
jason@plutext.orgSDN 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@plutext.org)