Author: hardy.ferentschik
Date: 2009-03-17 09:23:54 -0400 (Tue, 17 Mar 2009)
New Revision: 16168
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
Log:
HV-126 fixed bug when a cascaded value is null
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2009-03-17
13:00:53 UTC (rev 16167)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2009-03-17
13:23:54 UTC (rev 16168)
@@ -265,7 +265,7 @@
for ( MetaConstraint<T, ?> metaConstraint : beanMetaData.geMetaConstraintList() )
{
executionContext.pushProperty( metaConstraint.getPropertyName() );
if ( executionContext.isValidationRequired( metaConstraint ) ) {
- boolean tmp = metaConstraint.validateConstraint( executionContext );
+ boolean tmp = metaConstraint.validateConstraint( executionContext );
validationSuccessful = validationSuccessful && tmp;
}
executionContext.popProperty();
@@ -281,11 +281,10 @@
Type type = ReflectionHelper.typeOf( member );
context.pushProperty( ReflectionHelper.getPropertyName( member ) );
Object value = ReflectionHelper.getValue( member, context.peekCurrentBean() );
- if ( value == null ) {
- continue;
+ if ( value != null ) {
+ Iterator<?> iter = createIteratorForCascadedValue( context, type, value );
+ validateCascadedConstraint( context, iter );
}
- Iterator<?> iter = createIteratorForCascadedValue( context, type, value );
- validateCascadedConstraint( context, iter );
context.popProperty();
}
}
@@ -445,7 +444,6 @@
while ( groupIterator.hasNext() ) {
Group group = groupIterator.next();
validateValueForGroup(
- beanType,
value,
propertyIter,
failingConstraintViolations,
@@ -461,7 +459,6 @@
int numberOfConstraintViolations = failingConstraintViolations.size();
for ( Group group : sequence ) {
validateValueForGroup(
- beanType,
value,
propertyIter,
failingConstraintViolations,
@@ -476,7 +473,7 @@
}
}
- private <T> void validateValueForGroup(Class<T> beanType, Object value,
PropertyIterator propertyIter, List<ConstraintViolationImpl<T>>
failingConstraintViolations, Set<MetaConstraint<T, ?>> metaConstraints, Group
group) {
+ private <T> void validateValueForGroup(Object value, PropertyIterator
propertyIter, List<ConstraintViolationImpl<T>> failingConstraintViolations,
Set<MetaConstraint<T, ?>> metaConstraints, Group group) {
int numberOfConstraintViolations = failingConstraintViolations.size();
BeanMetaData<T> beanMetaData = getBeanMetaData(
metaConstraints.iterator().next().getBeanClass() );
Show replies by date