#157 Deep Mapping with custom setter method does not work

Dozer v4.4
Roman Stumm

See attached reproducer.

I get this exception when calling:
FlatClass clone = ...;
ParentClass p2 = (ParentClass) mapper.map(clone, ParentClass.class);

2008-12-22 18:47:02,516 ERROR net.sf.dozer.util.mapping.MappingProcessor - Field mapping error -->
MapId: null
Type: bi-directional
Source parent class: com.agimatec.connecta.xfire.ParentClass
Source field name: intermediate.details
Source field type: class java.util.ArrayList
Source field value: [com.agimatec.connecta.xfire.DetailClass@10bc49d]
Dest parent class: com.agimatec.connecta.xfire.ParentClass
Dest field name: intermediate.details
Dest field type: java.util.List
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at net.sf.dozer.util.mapping.util.ReflectionUtils.invoke(ReflectionUtils.java:256)
at net.sf.dozer.util.mapping.propertydescriptor.GetterSetterPropertyDescriptor.writeDeepDestinationValue(GetterSetterPropertyDescriptor.java:209)

Reason in net.sf.dozer.util.mapping.propertydescriptor.GetterSetterPropertyDescriptor.writeDeepDestinationValue

Method method = pd.getWriteMethod();
try {
if (method == null && getSetMethodName() != null) {
// lets see if we can find a custom method
method = ReflectionUtils.findAMethod(parentObj.getClass(), getSetMethodName());
} catch (NoSuchMethodException e) {

The custom setMethodName will only be used, when the default setter is NOT available. It should be used always when configured.


  • Roman Stumm

    Roman Stumm - 2008-12-22

    testcase, models, configuration

  • Matt Tierney

    Matt Tierney - 2008-12-24
    • milestone: 888638 --> Dozer v4.4
    • assigned_to: nobody --> mhtierney
    • status: open --> closed
  • Matt Tierney

    Matt Tierney - 2008-12-24

    Fixed and will be released with 4.4 soon. This use case was specific to when the default setter and custom setter are both available for the dest field


Log in to post a comment.

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

Sign up for the SourceForge newsletter:

No, thanks