[hibernate-issues] [Hibernate-JIRA] Resolved: (HV-53) AssertTrue and AssertFalse not compatible with null values
Hardy Ferentschik (JIRA)
noreply at atlassian.com
Tue Aug 19 06:17:43 EDT 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/HV-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hardy Ferentschik resolved HV-53.
---------------------------------
Resolution: Fixed
> AssertTrue and AssertFalse not compatible with null values
> ----------------------------------------------------------
>
> Key: HV-53
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-53
> Project: Hibernate Validator
> Issue Type: Bug
> Components: validators
> Affects Versions: 3.0.0.ga
> Reporter: benoit heinrich
> Assignee: Hardy Ferentschik
> Fix For: 3.1.0.CR2
>
>
> The AssertTrue and AssertFalse validators do not work with null values, they actually generate a NullPointerException.
> The code fix for this should be:
> public class AssertFalseValidator implements Validator<AssertFalse>, Serializable {
> public boolean isValid(Object value) {
> if (value == null) return true; << this is the fix
> return !(Boolean) value;
> }
> public void initialize(AssertFalse parameters) {
> }
> }
> public class AssertTrueValidator implements Validator<AssertTrue>, Serializable {
> public boolean isValid(Object value) {
> if (value == null) return true; << this is the fix
> return (Boolean) value;
> }
> public void initialize(AssertTrue parameters) {
> }
> }
> Cheers,
> /Benoit
--
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