This is an automated email from the ASF dual-hosted git repository.
rmannibucau pushed a commit to branch bval-1.1.x
in repository https://gitbox.apache.org/repos/asf/bval.git
The following commit(s) were added to refs/heads/bval-1.1.x by this push:
new 8235078 BVAL-177 fixed race condition during validator
creation/initilization
8235078 is described below
commit 8235078696ca48494ee3bb9124e73542db7ee579
Author: Lukasz Swiatek <[email protected]>
AuthorDate: Fri Aug 2 14:51:40 2019 +0200
BVAL-177 fixed race condition during validator creation/initilization
---
.../src/main/java/org/apache/bval/jsr/ConstraintValidation.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git
a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java
b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java
index 5b51141..05ab691 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java
@@ -155,11 +155,12 @@ public class ConstraintValidation<T extends Annotation>
implements Validation, C
synchronized (this) {
if (validator == null) {
try {
- validator =
getConstraintValidator(context.getConstraintValidatorFactory(), annotation,
- validatorClasses, owner, access);
- if (validator != null) {
- validator.initialize(annotation);
+ ConstraintValidator<T, ? super T> constraintValidator
= getConstraintValidator(
+ context.getConstraintValidatorFactory(),
annotation, validatorClasses, owner, access);
+ if (constraintValidator != null) {
+ constraintValidator.initialize(annotation);
}
+ validator = constraintValidator;
} catch (final RuntimeException re) {
if (ValidationException.class.isInstance(re)) {
throw re;