[hibernate-issues] [Hibernate-JIRA] Created: (HV-33) LengthValidator (@Length) should consider Character as valid

Dan Allen (JIRA) noreply at atlassian.com
Tue Jul 10 12:50:52 EDT 2007


LengthValidator (@Length) should consider Character as valid
------------------------------------------------------------

                 Key: HV-33
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-33
             Project: Hibernate Validator
          Issue Type: Improvement
          Components: validators
    Affects Versions: 3.0.0.ga
            Reporter: Dan Allen
            Priority: Minor


Currently, the LengthValidator only considers values of type java.lang.String. However, if the validation is @Length(max = 1), it should consider a value of type java.lang.Character as valid. I realize that is a pointless validation, but it is valid.  It came up because the reverse engineering tools places this validation on java.lang.Character and char properties.

The fix just requires inserting the code below in the second line of the LengthValidator#isValid method.

if ( ( value instanceof Character ) && max == 1 ) return true;

-- 
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