Rounding error when having a BigDecimal at runtime with @Max/@Min annotation set on a Number field

Description

I think I might have found a oddity in hibernate-validator 6.0.15.Final. It used to work with the version 5.4.2.Final.

Here is a test example:

The BigDecimal stored in a Number field will not trigger a constraint exception even though it is bigger than 1. And a bigdecimal such as 2.xxx would.

It feels like the validator does not (anymore) take into account the numbers after the comma in BigDecimals objects stored in a Number.

Environment

java version "1.8.0_201"
Windows 10

Activity

Show:
Guillaume Smet
March 2, 2019, 10:33 PM

Note: the issue concerns all the decimal types.

Assignee

Marko Bekhta

Reporter

Arnaud Villevieille

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

Priority

Major
Configure