You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Carlos Vara (JIRA)" <ji...@apache.org> on 2010/04/01 21:21:27 UTC

[jira] Created: (BVAL-15) @Min and @Max fail with very high values of long

@Min and @Max fail with very high values of long
------------------------------------------------

                 Key: BVAL-15
                 URL: https://issues.apache.org/jira/browse/BVAL-15
             Project: BeanValidation
          Issue Type: Bug
          Components: jsr303
    Affects Versions: 0.1-incubating
            Reporter: Carlos Vara


Current implementations of MinValidationForNumber and MaxValidatorForNumber fail when comparing very high long values. The reason is that they cast the value to a double before comparing, so long values that cast to the same double value may fail.

On a side note: Hibernate Validator has the same problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (BVAL-15) @Min and @Max fail with very high values of long

Posted by "Carlos Vara (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-15?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carlos Vara updated BVAL-15:
----------------------------

    Attachment: MinMaxValidatorsForNumberTest.java
                minmaxfix.diff

I attach a test case that shows the problem, and a diff with the fix.

Also, the fix is more in accordance with the spec which says that float/double values may not be correctly supported because of rounding errors, but integers should always work.

> @Min and @Max fail with very high values of long
> ------------------------------------------------
>
>                 Key: BVAL-15
>                 URL: https://issues.apache.org/jira/browse/BVAL-15
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>         Attachments: minmaxfix.diff, MinMaxValidatorsForNumberTest.java
>
>
> Current implementations of MinValidationForNumber and MaxValidatorForNumber fail when comparing very high long values. The reason is that they cast the value to a double before comparing, so long values that cast to the same double value may fail.
> On a side note: Hibernate Validator has the same problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (BVAL-15) @Min and @Max fail with very high values of long

Posted by "Roman Stumm (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-15?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roman Stumm reassigned BVAL-15:
-------------------------------

    Assignee: Roman Stumm

> @Min and @Max fail with very high values of long
> ------------------------------------------------
>
>                 Key: BVAL-15
>                 URL: https://issues.apache.org/jira/browse/BVAL-15
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Roman Stumm
>         Attachments: minmaxfix.diff, MinMaxValidatorsForNumberTest.java
>
>
> Current implementations of MinValidationForNumber and MaxValidatorForNumber fail when comparing very high long values. The reason is that they cast the value to a double before comparing, so long values that cast to the same double value may fail.
> On a side note: Hibernate Validator has the same problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (BVAL-15) @Min and @Max fail with very high values of long

Posted by "Roman Stumm (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-15?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roman Stumm updated BVAL-15:
----------------------------

    Fix Version/s: 0.1-incubating

> @Min and @Max fail with very high values of long
> ------------------------------------------------
>
>                 Key: BVAL-15
>                 URL: https://issues.apache.org/jira/browse/BVAL-15
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Roman Stumm
>             Fix For: 0.1-incubating
>
>         Attachments: minmaxfix.diff, MinMaxValidatorsForNumberTest.java
>
>
> Current implementations of MinValidationForNumber and MaxValidatorForNumber fail when comparing very high long values. The reason is that they cast the value to a double before comparing, so long values that cast to the same double value may fail.
> On a side note: Hibernate Validator has the same problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (BVAL-15) @Min and @Max fail with very high values of long

Posted by "Roman Stumm (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-15?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roman Stumm resolved BVAL-15.
-----------------------------

    Resolution: Fixed

Merged patch and Test into svn

> @Min and @Max fail with very high values of long
> ------------------------------------------------
>
>                 Key: BVAL-15
>                 URL: https://issues.apache.org/jira/browse/BVAL-15
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Roman Stumm
>         Attachments: minmaxfix.diff, MinMaxValidatorsForNumberTest.java
>
>
> Current implementations of MinValidationForNumber and MaxValidatorForNumber fail when comparing very high long values. The reason is that they cast the value to a double before comparing, so long values that cast to the same double value may fail.
> On a side note: Hibernate Validator has the same problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (BVAL-15) @Min and @Max fail with very high values of long

Posted by "Roman Stumm (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-15?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on BVAL-15 started by Roman Stumm.

> @Min and @Max fail with very high values of long
> ------------------------------------------------
>
>                 Key: BVAL-15
>                 URL: https://issues.apache.org/jira/browse/BVAL-15
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Roman Stumm
>         Attachments: minmaxfix.diff, MinMaxValidatorsForNumberTest.java
>
>
> Current implementations of MinValidationForNumber and MaxValidatorForNumber fail when comparing very high long values. The reason is that they cast the value to a double before comparing, so long values that cast to the same double value may fail.
> On a side note: Hibernate Validator has the same problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.