-
Notifications
You must be signed in to change notification settings - Fork 618
Closed
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged
Description
Neo4jTemplate.saveAllAs(Iterable<T>, Class<R>)
throws NullPointerException when given an empty list, for example
neo4jTemplate.saveAllAs(emptyList(), Projection.class);
throws the following Exception
java.lang.NullPointerException
at java.base/java.lang.Class.isAssignableFrom(Native Method)
at org.springframework.data.neo4j.core.Neo4jTemplate.saveAllAs(Neo4jTemplate.java:525)
at org.springframework.data.neo4j.integration.imperative.Neo4jTemplateIT.saveAllAsWithEmptyList(Neo4jTemplateIT.java:800)
TemplateSupport.findCommonElementType
returns null, which causes the NPE when null is passed to Class.isAssignableFrom
.
I could understand a NPE being thrown when null is passed in, but it seems unusual to throw a NPE in this case. Perhaps an empty list should be returned instead.
I'll open a pull request with a test and possible solution in a moment.
Metadata
Metadata
Assignees
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged