#23 Array to Array mapping issue

closed
None
5
2005-11-30
2005-11-19
No

I believe in the following use case Dozer req's a hint
when it should be able to do the mapping without
having to specify a hint in the mapping file.

SourceObj
NameValueDO[] nameValues

DestObj
NameValueVO[] nameValuePairs

The NameValueDO and NameValueVO are simple and both
have String props named: field1, field2

Dozer mapping......

<mapping>
<classA>SourceObj</classA>
<classB>DestObj</classB>
<field>
<A>nameValue</A>
<B>nameValuesPairs</B>
</field>
</mapping>

If the SourceObj contains only 1 element in the array
all is good.

If the SourceObj contains more than 1 element in the
array an exception is thrown. I think it is because
in the addOrUpdateToList method, the destEntry is set
to null for the 2 element(if you debug this you will
see what I mean). I think Dozer should be able to
handle this scenario without having to specifiy a
destination type hint….

The following is what I think is the problem code in
the addOrUpdateToList method....

// reset dest type
destEntryType = null;

Exception:
Caused by: java.lang.IllegalArgumentException: array
element type mismatch
at java.lang.reflect.Array.set(Native
Method)
at
net.sf.dozer.util.mapping.MappingProcessor.convertListT
oArray(MappingProcessor.java:746)
at
net.sf.dozer.util.mapping.MappingProcessor.mapArrayToAr
ray(MappingProcessor.java:697)
at
net.sf.dozer.util.mapping.MappingProcessor.mapCollectio
n(MappingProcessor.java:548)
at
net.sf.dozer.util.mapping.MappingProcessor.mapOrRecurse
Object(MappingProcessor.java:444)
at
net.sf.dozer.util.mapping.MappingProcessor.mapFromField
Map(MappingProcessor.java:298)
at
net.sf.dozer.util.mapping.MappingProcessor.map
(MappingProcessor.java:272)

Discussion

  • Matt Tierney

    Matt Tierney - 2005-11-19
    • assigned_to: nobody --> mhtierney
     
  • Franz Garsombke

    Franz Garsombke - 2005-11-26
    • assigned_to: mhtierney --> fgarsombke
     
  • Franz Garsombke

    Franz Garsombke - 2005-11-26

    Logged In: YES
    user_id=550744

    This is fixed and in CVS branch v15. Files touched were
    Hint.java. and MappingProcessor.java.

     
  • Franz Garsombke

    Franz Garsombke - 2005-11-26
    • status: open --> pending
     
  • Franz Garsombke

    Franz Garsombke - 2005-11-30
    • 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