#80 Recursive object mapping not working with interfaces

closed
None
5
2007-04-27
2007-02-12
No

The fix for the recursive mapping issue #1596766 works fine, but not if you do implement against interfaces.

The MappingProcessor compares in line 392 the classes of the already mapped value and destination type for equality. That does never work for interfaces compared with their implementation class.

If you change line 392 of MappingProcessor to the following code, everything works fine:

if (value != null && destFieldType.isAssignableFrom(value.getClass())) {
...

Discussion

  • Matt Tierney

    Matt Tierney - 2007-02-13
    • assigned_to: nobody --> mhtierney
     
  • Matt Tierney

    Matt Tierney - 2007-02-13

    Logged In: YES
    user_id=1236069
    Originator: NO

    Thanks for the code submission. I will apply this code and if all of the unit tests run green, we will include it in the next release

     
  • Christoph Göldner

    Logged In: YES
    user_id=1717313
    Originator: YES

    Hi, hope you get this patch into one of the next releases ;)

    I attached a testcase that demonstrates the problem. (Tested with JDK 1.5 and Dozer 3.2.1)

    The line to change as mentioned above is 416 of MappingProcessor in Dozer 3.2.1 release.

    Greetings,
    Christoph

    File Added: dozer-test-recursion-with-interfaces.zip

     
  • Matt Tierney

    Matt Tierney - 2007-04-17

    Logged In: YES
    user_id=1236069
    Originator: NO

    Sorry for not getting this in the 3.2.1 release. I am not sure how we missed it. I will apply this to the code base tonight and it will be included in the next release.

     
  • Matt Tierney

    Matt Tierney - 2007-04-17

    Logged In: YES
    user_id=1236069
    Originator: NO

    Fixed and checked in to the 3.3 code base. Sorry for missing this one in the last release. Thanks for taking the time to submit the bug and unit test!

     
  • Matt Tierney

    Matt Tierney - 2007-04-17
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-04-27
    • 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