Skip to content
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

Prevent NPE when 1:n relationships contains null elements. #782

Merged
merged 2 commits into from
Mar 25, 2020

Conversation

michael-simons
Copy link
Collaborator

This fixes #781.

@michael-simons michael-simons merged commit a48d593 into master Mar 25, 2020
@michael-simons michael-simons deleted the issue/781 branch March 25, 2020 13:21
michael-simons added a commit that referenced this pull request Mar 25, 2020
This introduces an `InvalidRelationshipTargetException` which is thrown when a user tries to persist a domain object holding a 1:n reference in a collection containing one or more `null` elements. This prevents a `NullpointerException` and fixes #781. 

The change also reduces the number of branches in `EntityGraphMapper#mapEntityReferences` as we can reuse an `iterableOf` helper introduced for the `SingleUseEntityMapper`. Making this helper available as a utils method, we could also remove similar usage in other areas as a side effect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException in EntityGraphMapper.mapEntityReferences, handle POST with wrong relationship
1 participant