1

I am using Orika in my project usually with great success.
I have added a new type, registered both source and target and when I map it using mapper.mapAsList(sourceList, targetClass) I get the following exception

[2015-02-11 19:58:19,836][ERROR][platform.fe.baseservice.utils.validators.BasicFEValidator] validateTransformingAPIModelToDataModel
java.lang.NullPointerException: null
    at ma.glasnost.orika.generated.Orika_HTML5Single_APIHTML5Single_Mapper808888457244295$34.mapAtoB(Orika_HTML5Single_APIHTML5_Mapper808888457244295$34.java) ~[na:na]
    at ma.glasnost.orika.impl.mapping.strategy.UseCustomMapperStrategy.map(UseCustomMapperStrategy.java:65) ~[orika-core-1.4.4.jar:na]
    at ma.glasnost.orika.impl.MapperFacadeImpl.mapAsCollection(MapperFacadeImpl.java:646) ~[orika-core-1.4.4.jar:na]
    at ma.glasnost.orika.impl.MapperFacadeImpl.mapAsList(MapperFacadeImpl.java:391) ~[orika-core-1.4.4.jar:na]
    at ma.glasnost.orika.impl.MapperFacadeImpl.mapAsList(MapperFacadeImpl.java:729) ~[orika-core-1.4.4.jar:na]
    ....
    ....

Just null pointer exception.

Now I have been trying to debug it for a long time but without success (mainly because most of it is generated code).

Questions:

  1. What is the best way to get a meaningful exception.
  2. How can I debug it?
  3. Is there a way to view the generated classes.

Thanks

Bick
  • 17,833
  • 52
  • 146
  • 251

2 Answers2

1

There's a troubleshooting guide here: http://orika-mapper.github.io/orika-docs/troubleshooting.html

What I did when I got some exceptions I couldn't figure out was to start with switching on the source generation (see the "Generate Source and/or Class Files" section, use the OrikaSystemProperties#WRITE_SOURCE_FILES and OrikaSystemProperties#WRITE_SOURCE_FILES_TO_PATH properties). Most of the times I could figure out what was null in my case.

If I still had doubts, I switched the compiler to Eclipse JDT (see the "Enable step-debugging" section) which takes a bit more effort than the previous solution, but gives you full debugging possibilities.

Adam Michalik
  • 9,678
  • 13
  • 71
  • 102
0

Faced similar issue. After 4 to 5 days of trial and error found that, my boolean property name was starting with "is". After correcting this, issue got resolved.

DecKno
  • 293
  • 1
  • 5
  • 21