[hibernate-issues] [Hibernate-JIRA] Created: (HV-23) NotEmptyValidator throws ClassCastException on non-null wrapper types

scott leberknight (JIRA) noreply at atlassian.com
Fri May 25 14:25:04 EDT 2007


NotEmptyValidator throws ClassCastException on non-null wrapper types
---------------------------------------------------------------------

                 Key: HV-23
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-23
             Project: Hibernate Validator
          Issue Type: Bug
          Components: validators
    Affects Versions: 3.0.0.ga, Bundle 3.2.1
            Reporter: scott leberknight
         Attachments: NotEmptyValidatorClassCastExceptionBugTest.java

The NotEmptyValidator.isValid() method throws a ClassCastException if a non-null primitive wrapper type (e.g. Long) is supplied as the argument. The method assumes that if the value is not null, is not an array, collection, or map, that it can be cast to a String, which it cannot for primitive wrappers. See attached JUnit test, which also contains a possible fix to the logic and has a test for the fix too. I put the file in the org.hibernate.validator package so it can be dropped in as-is to the Hibernate Validator codebase.

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