[hibernate-commits] [hibernate/hibernate-validator] 2c60f6: HV-1699 Change how numbers are compared in Max/Min...

Marko Bekhta noreply at github.com
Fri Mar 1 05:50:24 EST 2019


  Branch: refs/heads/master
  Home:   https://github.com/hibernate/hibernate-validator
  Commit: 2c60f6ba86e7efda9465b1a090b3ef4a8de1955f
      https://github.com/hibernate/hibernate-validator/commit/2c60f6ba86e7efda9465b1a090b3ef4a8de1955f
  Author: marko-bekhta <marko.prykladna at gmail.com>
  Date:   2019-03-01 (Fri, 01 Mar 2019)

  Changed paths:
    M engine/src/main/java/org/hibernate/validator/internal/constraintvalidators/bv/number/bound/MaxValidatorForNumber.java
    M engine/src/main/java/org/hibernate/validator/internal/constraintvalidators/bv/number/bound/MinValidatorForNumber.java
    M engine/src/main/java/org/hibernate/validator/internal/constraintvalidators/bv/number/bound/NumberComparatorHelper.java
    M engine/src/test/java/org/hibernate/validator/test/internal/constraintvalidators/bv/BaseMinMaxValidatorForNumberTest.java
    M engine/src/test/java/org/hibernate/validator/test/internal/constraintvalidators/bv/MaxValidatorForNumberTest.java

  Log Message:
  -----------
  HV-1699 Change how numbers are compared in Max/Min validators

- for Min/Max `Number` validators check if actual numbers are not with
floating point (float,double) and if they are direct them to correct
number comparator helper method
- for big numbers (BigDecimal, BigInteger) check in number comparator
helper before converting to long. If actual numbers are from a 'Big*'
classes direct the call to corresponding overloaded versions of the method
so that no data will be lost
- Compare floating point numbers using `Double#compare()`




More information about the hibernate-commits mailing list