404-not-find / orika

Automatically exported from code.google.com/p/orika
2 stars 0 forks source link

List mapping - Null pointer exception #150

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Following are the source and target classes which I am trying to map.
Source
======
public class A {
  private String id;
  private List<B> list;
  // Getter setter method
}
public class B {
  private String name;
  private String value;
}

Target
======
public class C {
  private D d;
}
public class D {
  private List<E> e;
}
public class E {
  private String name;
  private String value;
}

2. Mapping the above classes below.
mapperFactory.classMap(A.class, C.class)
.field("list{}", "d.e{}")
.byDefault()
.register();

mapperFactory.classMap(B.class, E.class).byDefault().register();

What is the expected output? What do you see instead?

The expected output is for the mapping to happen.  But it throws a Null pointer 
exception.  If I initialize the attribute d in the class definition of C, the 
mapping works properly.

What version of the product are you using? On what operating system?
Version 1.4.5.

Please provide any additional information below.
None.

Original issue reported on code.google.com by sundar.r...@gmail.com on 20 Mar 2014 at 3:25