Reputation: 1069
I have 2 objects that have the same "links" property, and when using Orika to map from A
-> B
, I get
ma.glasnost.orika.MappingException:ma.glasnost.orika.MappingException:
While attempting the following mapping:
sourceType = A
sourceProperty = links(Links)
destinationType = B
destinationProperty = links(Links)
Error occurred: java.lang.NullPointerException
Caused by: ma.glasnost.orika.MappingException: java.lang.NullPointerException
at ma.glasnost.orika.impl.generator.MapperGenerator.addMapMethod(MapperGenerator.java:170)
at ma.glasnost.orika.impl.generator.MapperGenerator.build(MapperGenerator.java:70)
... 49 common frames omitted
Caused by: java.lang.NullPointerException: null
at ma.glasnost.orika.impl.generator.VariableRef.isPrimitive(VariableRef.java:167)
at ma.glasnost.orika.impl.generator.VariableRef.<init>(VariableRef.java:95)
at ma.glasnost.orika.impl.generator.specification.MapToMap.generateMappingCode(MapToMap.java:71)
at ma.glasnost.orika.impl.generator.SourceCodeContext.mapFields(SourceCodeContext.java:778)
at ma.glasnost.orika.impl.generator.MapperGenerator.generateFieldMapCode(MapperGenerator.java:247)
at ma.glasnost.orika.impl.generator.MapperGenerator.addMapMethod(MapperGenerator.java:167)
... 50 common frames omitted
The objects are defined like so:
class A {
private Links links
// getter/setter + other fields
}
class B {
private Links links
// getter/setter + other fields
}
class Links extends HashMap<String, List<Link>> {
}
class Link {
private String text;
}
I'm using the default mapper like so:
mapper.classMap(A.class, B.class)
.byDefault()
.register();
Any suggestions for proceeding?
Upvotes: 0
Views: 1301
Reputation: 4615
YOu're seeing this: https://code.google.com/archive/p/orika/issues/170
It says the issue was fixed here but it doesn't look the same to me: https://github.com/orika-mapper/orika/issues/67
or maybe this one is what you're seeing: https://github.com/orika-mapper/orika/issues/232
Your issue looks identical to the one posted at code.google.com
Upvotes: 1