spring-data-rest
spring-data-rest copied to clipboard
Prevent NPE from occurring
Hi, I think NotNull Message looks better than NPE.
- [x] You have read the Spring Data contribution guidelines.
- [x] You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
- [x] You submit test cases (unit or integration tests) that back your changes.
- [x] You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).
How did you encounter a null pointer at ValidationErrors? Do you have a stack trace handy?
There is no reason for an NPE to occur in ValidationErrors.
But if you look at the existing code
Assert.notNull(source, "Entity must not be null");
Since there is a logic to check null, I thought we considered the possibility of it occurring.