Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » MOXy and JAXB Marshaller.Listener getting XMLRoot object
MOXy and JAXB Marshaller.Listener getting XMLRoot object [message #989577] Thu, 06 December 2012 19:56 Go to next message
Patrick Schilling is currently offline Patrick SchillingFriend
Messages: 5
Registered: December 2012
Junior Member
I have a JAXB Marshaller.Listener, and I am getting an XMLRoot object in beforeMarshal instead of a JAXBElement. Is this expected behavior? I am trying to read the fields with source.getClass().getDeclaredFields(), and it doesn't work on the XMLRoot without making this MOXy specific.

I am using EclipseLink 2.4.1 with CXF 2.7.0.

Thanks,

Patrick
Re: MOXy and JAXB Marshaller.Listener getting XMLRoot object [message #989792 is a reply to message #989577] Fri, 07 December 2012 19:51 Go to previous messageGo to next message
Rick Barkhouse is currently offline Rick BarkhouseFriend
Messages: 22
Registered: July 2009
Junior Member
Hi Patrick,

It looks like you've identified a bug here, XMLRoot is EclipseLink's legacy version of a JAXBElement, and it should not be given to the Listener when in a JAXB context.

We'll begin working on a fix, I've entered a bug that you can track here:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=396073

If you have any more information you'd like to provide, you can add it directly to the bug.

Thanks,
Rick
Re: MOXy and JAXB Marshaller.Listener getting XMLRoot object [message #989802 is a reply to message #989792] Fri, 07 December 2012 21:55 Go to previous messageGo to next message
Patrick Schilling is currently offline Patrick SchillingFriend
Messages: 5
Registered: December 2012
Junior Member
Rick,

Thanks, I appreciate the response. Is there any other specific information you need? Otherwise, I will track the progress on the bug.

-Patrick
Re: MOXy and JAXB Marshaller.Listener getting XMLRoot object [message #989918 is a reply to message #989802] Mon, 10 December 2012 02:11 Go to previous messageGo to next message
Rick Barkhouse is currently offline Rick BarkhouseFriend
Messages: 22
Registered: July 2009
Junior Member
Hi Patrick,

No, nothing more needed. I have a patch that will ensure you get back a corresponding JAXBElement instead of XMLRoot. It should be reviewed and checked in on Monday.

- Rick
Re: MOXy and JAXB Marshaller.Listener getting XMLRoot object [message #990068 is a reply to message #989918] Mon, 10 December 2012 17:43 Go to previous messageGo to next message
Rick Barkhouse is currently offline Rick BarkhouseFriend
Messages: 22
Registered: July 2009
Junior Member
Hi Patrick, I've checked in a fix, it should be available in the Dec 10 nightly build. Thanks for turning that up!

Rick
Re: MOXy and JAXB Marshaller.Listener getting XMLRoot object [message #990084 is a reply to message #990068] Mon, 10 December 2012 19:34 Go to previous messageGo to next message
Patrick Schilling is currently offline Patrick SchillingFriend
Messages: 5
Registered: December 2012
Junior Member
Rick,

Great, thanks for the help! I'll check it out when the nightly build is available.

Patrick
Re: MOXy and JAXB Marshaller.Listener getting XMLRoot object [message #990313 is a reply to message #990084] Tue, 11 December 2012 19:26 Go to previous messageGo to next message
Patrick Schilling is currently offline Patrick SchillingFriend
Messages: 5
Registered: December 2012
Junior Member
Rick,

I verified that the nightly build is now returning a JAXBElement as expected. Thanks again for the quick response.

I have another question about the behavior of the Marhsaller.Listener in MOXy versus the reference implementation. In the RI, the Marshaller.Listener is called with the JAXBElement, and is subsequently called with an Object of the type parameter (what would be returned by JAXBElement<T>.getValue()), and then on to any children of T. In MOXY, it is called with the JAXBElement, and then skips right to the children of T. Do you know the reason for this difference?

Thanks,

Patrick
Re: MOXy and JAXB Marshaller.Listener getting XMLRoot object [message #990321 is a reply to message #990313] Tue, 11 December 2012 20:44 Go to previous messageGo to next message
Rick Barkhouse is currently offline Rick BarkhouseFriend
Messages: 22
Registered: July 2009
Junior Member
Hi Patrick, I had noticed that the RI was firing that event more than once, but I don't think we were ever aware of that behaviour from the RI. I don't believe there was a conscious decision NOT to fire it. The javadocs and JAXB Spec information don't indicate that these methods should be called multiple times, so I think EclipseLink is satisfying the contract.

You shouldn't be at a loss for any information, as you can always get the value from the JAXBElement.

- Rick

Re: MOXy and JAXB Marshaller.Listener getting XMLRoot object [message #990504 is a reply to message #990321] Wed, 12 December 2012 19:07 Go to previous message
Patrick Schilling is currently offline Patrick SchillingFriend
Messages: 5
Registered: December 2012
Junior Member
Rick,

Yes, getting the value from JAXBElement does work, but the behavior will be slightly different in the RI, as I will end up processing the root element twice. Either way, it will work for my needs.

Thanks,

Patrick
Previous Topic:JPQL query with ElementCollection throw exception
Next Topic:EntityManagerFactory (Eclipselink RCP) return NullPointerException
Goto Forum:
  


Current Time: Thu Apr 25 08:32:40 GMT 2024

Powered by FUDForum. Page generated in 0.04608 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top