NullPointer when WeakReference cached type is GC'd
Closed this issue · 2 comments
fernandosiq-dh commented
Hello,
We are currently having intermittent problems during unit tests in our build that breaks because of a NPE in Orika.
Here is my fix: https://github.com/orika-mapper/orika/pull/342/files
I investigated the issue, seems to be related to TypeFactory cache, that holds a WeakReference for the type that is not properly checked for nulls, and hence will return Null as Type.
Unfortunately there is no easy way to reproduce a WeakReference being GC'd, so I wasn't able to think of a unit test to share reproducing the problem.
stapetro commented
Please try to reproduce it with a test.
stapetro commented
@fernandosiq-dh Please close the issue since the pull request is now merged. Thx.