New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException in EdgeBuilder.java #638

Closed
lybeck opened this Issue Feb 21, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@lybeck
Contributor

lybeck commented Feb 21, 2018

EdgeBuilder.java throws a NullPointerException for null-values in maps. An example can be found here: https://github.com/lybeck/javers/blob/map-null-value-problem/javers-core/src/main/java/org/javers/core/example/Main.java

The problem only occurs when an object has a map with a custom class as a key-type, for example Map<CustomKey, String>, but not with maps such as Map<String, String>, which work fine with null-values.

Stack trace of the exception:
Exception in thread "main" java.lang.NullPointerException at org.javers.core.graph.EdgeBuilder$MultiEdgeMapBuilderFunction.isManagedPosition(EdgeBuilder.java:88) at org.javers.core.graph.EdgeBuilder$MultiEdgeContainerBuilderFunction.apply(EdgeBuilder.java:69) at org.javers.core.metamodel.type.MapType.mapEntrySet(MapType.java:76) at org.javers.core.metamodel.type.MapType.mapStatic(MapType.java:40) at org.javers.core.metamodel.type.MapType.map(MapType.java:27) at org.javers.core.graph.EdgeBuilder.createMultiEdge(EdgeBuilder.java:55) at org.javers.core.graph.ObjectGraphBuilder.buildMultiEdges(ObjectGraphBuilder.java:91) at org.javers.core.graph.ObjectGraphBuilder.buildEdges(ObjectGraphBuilder.java:71) at org.javers.core.graph.ObjectGraphBuilder.buildGraphFromCdo(ObjectGraphBuilder.java:58) at org.javers.core.graph.ObjectGraphBuilder.buildGraph(ObjectGraphBuilder.java:47) at org.javers.core.graph.LiveGraphFactory.createLiveGraph(LiveGraphFactory.java:39) at org.javers.core.diff.DiffFactory.buildGraph(DiffFactory.java:98) at org.javers.core.diff.DiffFactory.compare(DiffFactory.java:53) at org.javers.core.JaversCore.compare(JaversCore.java:134) at org.javers.core.example.Main.main(Main.java:37)

@bartoszwalacik bartoszwalacik added the bug label Feb 21, 2018

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Feb 28, 2018

Thanks for reporting and the good reproduction, I will take a look at this

bartoszwalacik added a commit that referenced this issue Mar 3, 2018

bartoszwalacik added a commit that referenced this issue Mar 3, 2018

@bartoszwalacik bartoszwalacik added the fixed label Mar 4, 2018

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Mar 4, 2018

fixed in 3.8.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment