[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-423) @Min broken with BigInteger/BigDecimal

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed Aug 30 23:58:24 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-423?page=comments#action_24241 ] 

Emmanuel Bernard commented on ANN-423:
--------------------------------------

So we can exclude all BigDecimal / BigInteger on range to make it consistent and let the issue arise at developement time (at least unit testing)
or we can allow BigDecimal / BigInteger and raise an exception if we are above the limit cases happends where min or max is unset, such an issue will arise most likely in production only... I'm not a big fan of that.

> @Min broken with BigInteger/BigDecimal
> --------------------------------------
>
>          Key: ANN-423
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-423
>      Project: Hibernate Annotations
>         Type: Bug

>   Components: validator
>     Versions: 3.2.0.cr1
>  Environment: Hibernate 3.2.0cr2
>     Reporter: Dan Armak
>     Priority: Minor
>      Fix For: 3.2.0.cr2
>  Attachments: Test.java, Validator.diff
>
>
> MinValidator supports properties of type BigInteger and BigDecimal by coding against Number.longValue(). However, in BigInteger and BigDecimal, longValue() returns the lower 64 bits, which can flip the apparent sign for a BigInteger > Long.MAX_VALUE or < Long.MIN_VALUE. In these cases, @Min or @Max validation (respectively) will fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list