Today i found a valid cnpj not passing {{ @CNPJ }} validation constraint. After digging a little, i realized that all valid cnpj with check digit 0 were failing.
Looking at the source of {{ CNPJValidator }} i found an issue with the configuration of the {{ Mod11CheckValidator }} , in the initialization an 'X' was supplied as {{ treatCheck10As }} parameter. But a valid cnpj doesn't contains 'X' character, in this case a ' 0 ' was expected. (the same as {{ CPFValidator }} ).
I've tested against hibernate validator 5.2.0.CR1 and 5.2.0.Alpha1, and both versions were failing.
I've also created a pull request with the test case i found the bug.
|