-
Notifications
You must be signed in to change notification settings - Fork 617
Neo4jTemplate.saveAllAs throws NullPointerException when given empty list #2544
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
Labels
status: waiting-for-triage
An issue we've not yet triaged
Comments
cberes
added a commit
to cberes/spring-data-neo4j
that referenced
this issue
May 27, 2022
… given empty iterable.
cberes
added a commit
to cberes/spring-data-neo4j
that referenced
this issue
May 27, 2022
… given empty iterable.
cberes
added a commit
to cberes/spring-data-neo4j
that referenced
this issue
May 27, 2022
… given empty iterable.
michael-simons
added a commit
that referenced
this issue
May 30, 2022
When an empty collection is passed to imperative and reactive `saveAllAs` variants a common element type can't be computed. We did not check for this scenario correctly and failed with a NPE. The introduction of a marker class fixes #2544 Co-authored-by: Michael Simons <[email protected]>
michael-simons
added a commit
that referenced
this issue
May 30, 2022
When an empty collection is passed to imperative and reactive `saveAllAs` variants a common element type can't be computed. We did not check for this scenario correctly and failed with a NPE. The introduction of a marker class fixes #2544 Co-authored-by: Michael Simons <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Neo4jTemplate.saveAllAs(Iterable<T>, Class<R>)
throws NullPointerException when given an empty list, for examplethrows the following Exception
TemplateSupport.findCommonElementType
returns null, which causes the NPE when null is passed toClass.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.
The text was updated successfully, but these errors were encountered: