#42 Wrong field mapped when an instance is passed in.

closed
None
5
2006-04-12
2006-03-22
No

Problem:

class A
class B extends A

S s = new S();
s.setF("field3");
A a = new A();
mapper.map(s, a);

<mapping>
<class-a>simple.S</class-a>
<class-b>simple.B</class-b>
<field>
<a>f</a>
<b>field1</b>
</field>
</mapping>

With this situation we would pull the field mapping
from the mapping file even though Class A does not have
any fields that need to be mapped. The wrong mapping
was used. We need to verify that an instance is being
passed in and not look for and not walk down the
subclasses to find a mapping.

Changed this code:

if (mapping == null && !isInstance) {
mapping = walkDownSubclasses(destClass, sourceObj);
}

Discussion

  • Franz Garsombke

    Franz Garsombke - 2006-04-11
    • status: open --> pending
     
  • Franz Garsombke

    Franz Garsombke - 2006-04-12
    • 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