Hi,
I have similar (or the same) problem that was described in HV-1013. That is, a object, which has mandatory field (@NotNull) which I want to validate. While validation is done and the field is null, the validator ends up calling object's hashCode which in our case tries to call member variables hashCode for null field. This lead to the NPE. The original ticket issue was fixed in HV-848, but there seems to be another hashCode call involved in the validation process. The call is done here while validator creates a new ConstraintViolation for mandatory field being null : https://github.com/hibernate/hibernate-validator/blob/master/engine/src/main/java/org/hibernate/validator/internal/engine/ConstraintViolationImpl.java#L330
I created a simple test, where the problem happens: https://github.com/VaiTuomoMakela/NotNullHibernateValidation The reason to use the test case's implementation in the object hashCode is that it is similar to what Immutables auto-generates, which are in use in our case.
Could the same approach be used in this case what was used in HV-848 in the previous case to change hashCode() -calls to System#identityHashCode()?
Thanks in advance! |
|