we gettting NullPointerException while mapping a domain object to XML Bean Array compiled for Java 1.5.
The mapping is working fine while converting from XML Bean to domain object.
The opposite i.e; Domain to XML bean does not work.
I created the domain bean EmployeeDet similar to the xml bean. As mentioned below the mappings work only if we add a element to list.
I think Dozer is unable to initialize the List before setting the value.
----------------------------------
Class
----------------------------------
class EmployeeDet {
ArrayList store=new ArrayList();
java.util.List<some.domain.Employee> getEmployeeList(){
final class EmployeeList extends java.util.AbstractList<some.domain.Employee> {
void put(int i, Object o){}
void add(int i, Object o){}
void remove(int i){ }
}
EmployeeList list=new EmployeeList();
return list;
}
}
----------------------------------
Mapping
----------------------------------
<mapping>
<class-a>some.domain.Employee</class-a>
<class-b>some.domain.EmployeeDet</class-b>
<field>
<a>firstName</a>
<b>EmployeeList[0].name</b>
</field>
</mapping>
bump
If you could just create a unit test and attach that to the issue this problem will be next on my fix list :)
Could you attach xml schema for your XMl Bean, please?