Closed NBau closed 7 years ago
Thank you for reporting this issue, I will look into this.
Could you please try 7.0.3 snapshot https://oss.sonatype.org/content/repositories/snapshots/uk/co/jemos/podam/podam/7.0.3-SNAPSHOT/podam-7.0.3-20161125.185719-1.jar ?
Thank you for the quick reply. It looks like you fixed the issue. Perfect!
Oh, actually I just saw that there is still one issue remaining:
when just setting the @Digits
, the random value will never be negative. The reason is that min is initialized with Double.MIN_VALUE
, (line 127) which is defined as 2E-1074, i.e. just a little above 0. When calculating the min based on the @Digits
, it is set to max.negate().max(min);
(line 160). The statement in line 160 is correct, but the min should be initialized with -Double.MAX_VALUE
in line 127 to make sure that the correct minimum is set.
Ok, that seems to have fixed the issue. Thank you again for the great support.
When a bean attribute is annotated with
@DecimalMin
annotation and no@DecimalMax
is set, the BeanValidationStrategy assumes a maximum ofDouble.MAX_VALUE
(line 115). This does not take into account the@Digits
annotation, which may actually imply a different maximum.When
@DecimalMax
is set without@DecimalMin,
the BeanValidationStrategy assumes a minimum ofDouble.MIN_VALUE
, which is the smallest non-negative number. However, the actual minimum could be actually negative, again influenced by the number of allowed digits in the@Digits
annotation.I think the minimum and maximum need to be calculated from the combination of the
@Digits
and@DecimalMax/Min
values.