Menu

#20 Index mapping in destination field

open
None
5
2008-09-30
2008-08-21
No

When you have a mapping like
<mapping>
<class-a>vo.SourceObject</class-a>
<class-b>vo.DestObject</class-b>
<field>
<a>value</a>
<b>list[0].value</b>
</field>
</mapping>

A NullPointerException is generated because list[0] is not instantiate by dozer.

The problem is GetterSetterPropertyDescriptor class verify if the value of the current object is null before creating it.

When object is an array or a collection element, object tested is a collection so it does not null and element is not created.

The patch I created, modify test condition in GetterSetterPropertyDescriptor class. It verify if object is null or if element specified it is null in case of an array or a collection.

The patch is based on version 4.2.1.

Regards,
Mickael

Discussion

  • Mickael Morier

    Mickael Morier - 2008-08-21
     
  • Mickael Morier

    Mickael Morier - 2008-08-21

    Logged In: YES
    user_id=2176658
    Originator: YES

    File Added: dozer-patch-index-destination.patch

     
  • Mickael Morier

    Mickael Morier - 2008-08-21

    Logged In: YES
    user_id=2176658
    Originator: YES

    I forgot to precise that this problem appears for JAXB objects where in all getters of list, list are instantiated if it is null.

     
  • dmitry (lv)

    dmitry (lv) - 2008-09-30
    • assigned_to: nobody --> buzdin
     
  • Matt Tierney

    Matt Tierney - 2008-12-06

    Hi Mickael,

    Thanks for submitting the patch. I am going to try and get this in the 4.4 release. Can you submit a simple as possible unit test that reproduces the issue. That way we can add it to our regression test suite and be able to confirm that the patch resolves your issue? Thanks

     

Log in to post a comment.