Skip to content

Commit defe44e

Browse files
committed
Merge pull request #9889 from theaspect/2.5.x
Fix for ConcurrentModificationException backported to grails 2.5.4.
2 parents 5bfd763 + b509b7c commit defe44e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

grails-plugin-validation/src/main/groovy/grails/validation/trait/Validateable.groovy

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ trait Validateable {
6363
if(this.constraintsMapInternal == null) {
6464
BeanFactory ctx = Holders.applicationContext
6565
ConstraintsEvaluator evaluator = ctx.getBean(ConstraintsEvaluator.BEAN_NAME, ConstraintsEvaluator)
66-
this.constraintsMapInternal = evaluator.evaluate this, defaultNullable()
66+
def evaluatedConstraints = evaluator.evaluate(this, defaultNullable())
6767

6868
if(!defaultNullable()) {
6969
def methods = this.getDeclaredMethods()
@@ -74,15 +74,16 @@ trait Validateable {
7474
def propertyName = GrailsNameUtils.getPropertyName(methodName[3..-1])
7575
if(propertyName != 'metaClass' &&
7676
propertyName != 'errors' &&
77-
!this.constraintsMapInternal.containsKey(propertyName)) {
77+
!evaluatedConstraints.containsKey(propertyName)) {
7878
def cp = new ConstrainedProperty(this, propertyName, method.returnType)
7979
cp.applyConstraint 'nullable', false
80-
this.constraintsMapInternal.put propertyName, cp
80+
evaluatedConstraints.put propertyName, cp
8181
}
8282
}
8383
}
8484
}
8585
}
86+
this.constraintsMapInternal = evaluatedConstraints
8687
}
8788
this.constraintsMapInternal
8889
}

0 commit comments

Comments
 (0)