#67 Wildcard mapping not working with XMLBeans

closed
None
5
2007-02-09
2007-01-16
Peter Monks
No

I'm currently running Dozer 2.2 but have run into problems with ConcurrentModificationExceptions. Seeing that some of these have been fixed I'm attempting to upgrade to Dozer 2.4, but have run into some regressions. Specifically, wildcard mapping no longer seems to pick up attributes that are "inherited" in the XML Schema (XML Beans converts this into a hierarchy of interfaces in the generated code).

The attached JUnit test demonstrates this behaviour: the "Fu" and "Bar" attributes of the generated "ChildType" class are mapped correctly, while the "Id" and "Name" attributes (inherited from "ParentType") are not mapped at all.

Discussion

  • Matt Tierney

    Matt Tierney - 2007-01-16

    Logged In: YES
    user_id=1236069
    Originator: NO

    Thanks for the submission and including a junit test. I will look at this very soon. We are planning the next release towards the end of this month so I will do everything I can to resolve this in that release.

    Did you happen to try it with the 2.3 jar. I am trying to narrow down whether the issue showed up in 2.3 or the latest 2.4

     
  • Peter Monks

    Peter Monks - 2007-01-16

    JUnit Test Case demonstrating the problem

     
  • Peter Monks

    Peter Monks - 2007-01-16

    Logged In: YES
    user_id=7747
    Originator: YES

    G'day Matt,

    I'll give Dozer 2.3 a spin later on today and report back with the results. I've also updated the JUnit test slightly to more clearly demonstrate the problem (I moved the failing assertions for "Id" and "Name" to the end, to show that "Fu" and "Bar" are being mapped correctly).

    Cheers,
    Peter
    File Added: DozerTestXMLBeans.zip

     
  • Peter Monks

    Peter Monks - 2007-01-16

    Logged In: YES
    user_id=7747
    Originator: YES

    I just ran the unit tests against both 2.3 and 2.2, and they fail the same way on all three versions (2.2, 2.3 and 2.4). This suggests that either it's a new problem rather than a regression, or I've done something wrong in the unit test (which seems unlikely given how simple it is). Perhaps you could give the test scenario a quick once over to make sure I didn't do anything silly?

    I'm also going to dive back into my real code and work out why 2.2 is working whereas 2.4 isn't - it must be something else that's causing problems.

     
  • Peter Monks

    Peter Monks - 2007-01-16
    • summary: Regression: wilcard mapping not working with XMLBeans --> Wilcard mapping not working with XMLBeans
     
  • Peter Monks

    Peter Monks - 2007-01-16
    • summary: Wilcard mapping not working with XMLBeans --> Wildcard mapping not working with XMLBeans
     
  • Matt Tierney

    Matt Tierney - 2007-01-16

    Logged In: YES
    user_id=1236069
    Originator: NO

    Thanks for the addt'l information. This will help diagnosing the issue. I probably wont get a chance to work on this before the weekend/early next week. I am going to be working on the release next week so that is when I will probably look deeper into the issue. Thanks again for the unit tests. I can't tell you how much easier that makes it for me to diagnose. In the meantime, just let me know if you find any more clues.

     
  • Peter Monks

    Peter Monks - 2007-01-17

    Logged In: YES
    user_id=7747
    Originator: YES

    Thanks Matt - one of things I like about Dozer is how responsive you guys are. The least I can do is provide unit tests to help you troubleshoot things! ;-)

     
  • Matt Tierney

    Matt Tierney - 2007-01-29

    Logged In: YES
    user_id=1236069
    Originator: NO

    I was able to recreate the issue using your test case. Thanks again for submitting the test case. It saved me a bunch of time.

    After looking at the code, I think this issue has been around forever and I don't think it
    is specific to XMLBean objects. The problem appears to be specific to interface inheritance. Dozer uses apache commons bean util's PropertyUtils.getPropertyDescriptors() introspect data objects via reflection. Unfortunately the getPropertyDescriptors doesn't return super class properties when you have interface inheritance. If you dig deeper, the real problem appears to be in Introspector.getBeanInfo() which PropertyUtils uses.

    PropertyDescriptor[] pds =
    PropertyUtils.getPropertyDescriptors(net.pmonks.xml.dozer.test.ChildType.class);

     
  • Matt Tierney

    Matt Tierney - 2007-01-29
    • assigned_to: nobody --> mhtierney
     
  • Matt Tierney

    Matt Tierney - 2007-01-29
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-01-29

    Logged In: YES
    user_id=1236069
    Originator: NO

    I fixed this issue in the 2.5 code base w/o much trouble. We have a reflection utils class that encapsulates the use of the problem PropertyUtils, so I was able to just add some logic to that class to handle the interface inheritance scenario. The logic added just recursively walks the inheritance hierarchy for interfaces looking for all property descriptors. All unit tests pass after making the change. I googled for Introspector.getBeanInfo issues for interface inheritance and it looks as if it's been a problem for a long time.

    Peter, thanks for letting us know about the issue!

     
  • Matt Tierney

    Matt Tierney - 2007-02-09
    • status: pending --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks