limcheekin / jquery-validation-ui

JQuery Validation UI Plugin - Client Side Validation without writing JavaScript
http://limcheekin.github.io/jquery-validation-ui/
Apache License 2.0
20 stars 18 forks source link

ValidationService.getConstrainedProperties method has concurrent issue #31

Open ghost opened 11 years ago

ghost commented 11 years ago

When two thread run into this method at a same time, they all get closure

def validationClosure = validatableClass.constraints

The problem is two thread get same instance of closure. So when

validationClosure.setDelegate(constrainedPropertyBuilder)

is executed one by one, it may cause previous constrainedPropertyBuilder overwrited by later constrainedPropertyBuilder.

The worst result of this issue is application go into a loop and never break. Will take some times to explain why go int a loop, in short, it was some HashMap code.

change to below code should fix the issue: def validationClosure = validatableClass.constraints.clone()