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
Logged In: YES
user_id=2176658
Originator: YES
File Added: dozer-patch-index-destination.patch
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.
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