bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1766546 [4/7] - in /bval/trunk: bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/model/ bval-core/src/main/java/org/apache/bval/util/ bval-core/src/main/java/org/apache/bval/util/reflection/ bval-core/src/te...
Date Tue, 25 Oct 2016 15:34:38 GMT
Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java Tue Oct 25 15:34:35 2016
@@ -142,7 +142,8 @@ public class ClassValidator implements C
         }
     }
 
-    private <T> Set<ConstraintViolation<T>> validateBeanWithGroups(final GroupValidationContext<T> context, final Groups sequence) {
+    private <T> Set<ConstraintViolation<T>> validateBeanWithGroups(final GroupValidationContext<T> context,
+        final Groups sequence) {
         final ConstraintValidationListener<T> result = context.getListener();
 
         // 1. process groups
@@ -391,14 +392,15 @@ public class ClassValidator implements C
 
                 // For each owner in the hierarchy
                 for (final Class<?> owner : classHierarchy) {
-                    
+
                     context.setCurrentOwner(owner);
 
                     int numViolations = result.violationsSize();
 
                     // Obtain the group sequence of the owner, and use it for
                     // the constraints that belong to it
-                    final List<Group> ownerDefaultGroups = context.getMetaBean().getFeature("{GroupSequence:" + owner.getCanonicalName() + "}");
+                    final List<Group> ownerDefaultGroups =
+                        context.getMetaBean().getFeature("{GroupSequence:" + owner.getCanonicalName() + "}");
                     for (Group each : ownerDefaultGroups) {
                         context.setCurrentGroup(each);
                         validateBean(context);
@@ -432,7 +434,7 @@ public class ClassValidator implements C
             if (group == mappedGroup) {
                 validateCascadedBean(context, prop, null);
             } else {
-                final Groups propertyGroup = groupsComputer.computeGroups(new Class<?>[]{ mappedGroup.getGroup() });
+                final Groups propertyGroup = groupsComputer.computeGroups(new Class<?>[] { mappedGroup.getGroup() });
                 validateCascadedBean(context, prop, propertyGroup);
             }
             context.setCurrentGroup(group);
@@ -442,7 +444,8 @@ public class ClassValidator implements C
     // TODO: maybe add a GroupMapper to bval-core to ease this kind of thing and void to fork this method from ValidationHelper
     private void validateBean(final GroupValidationContext<?> context) {
         // execute all property level validations
-        for (final PropertyDescriptor prop : getConstraintsForClass(context.getMetaBean().getBeanClass()).getConstrainedProperties()) {
+        for (final PropertyDescriptor prop : getConstraintsForClass(context.getMetaBean().getBeanClass())
+            .getConstrainedProperties()) {
             final PropertyDescriptorImpl impl = PropertyDescriptorImpl.class.cast(prop);
             if (!impl.isValidated(impl)) {
                 checkValidationAppliesTo(impl.getConstraintDescriptors(), ConstraintTarget.PARAMETERS);
@@ -464,8 +467,10 @@ public class ClassValidator implements C
             if (ConstraintValidation.class.isInstance(validation)) {
                 final ConstraintValidation<?> constraintValidation = ConstraintValidation.class.cast(validation);
                 if (!constraintValidation.isValidated()) {
-                    checkValidationAppliesTo(constraintValidation.getValidationAppliesTo(), ConstraintTarget.PARAMETERS);
-                    checkValidationAppliesTo(constraintValidation.getValidationAppliesTo(), ConstraintTarget.RETURN_VALUE);
+                    checkValidationAppliesTo(constraintValidation.getValidationAppliesTo(),
+                        ConstraintTarget.PARAMETERS);
+                    checkValidationAppliesTo(constraintValidation.getValidationAppliesTo(),
+                        ConstraintTarget.RETURN_VALUE);
                     constraintValidation.setValidated(true);
                 }
             }
@@ -479,21 +484,23 @@ public class ClassValidator implements C
      * @param context The current validation context.
      * @param prop    The property to cascade from (in case it is possible).
      */
-    private void validateCascadedBean(final GroupValidationContext<?> context, final MetaProperty prop, final Groups groups) {
+    private void validateCascadedBean(final GroupValidationContext<?> context, final MetaProperty prop,
+        final Groups groups) {
         final AccessStrategy[] access = prop.getFeature(Features.Property.REF_CASCADE);
         if (access != null) { // different accesses to relation
             // save old values from context
             final Object bean = context.getBean();
             final MetaBean mbean = context.getMetaBean();
             // TODO implement Validation.groups support on related bean
-//            Class[] groups = prop.getFeature(JsrFeatures.Property.REF_GROUPS);
+            //            Class[] groups = prop.getFeature(JsrFeatures.Property.REF_GROUPS);
             for (final AccessStrategy each : access) {
                 if (isCascadable(context, prop, each)) {
                     // modify context state for relationship-target bean
                     context.moveDown(prop, each);
                     // validate
                     if (groups == null) {
-                        ValidationHelper.validateContext(context, new JsrValidationCallback(context), factoryContext.isTreatMapsLikeBeans());
+                        ValidationHelper.validateContext(context, new JsrValidationCallback(context),
+                            factoryContext.isTreatMapsLikeBeans());
                     } else {
                         ValidationHelper.validateContext(context, new ValidationHelper.ValidateCallback() {
                             @Override
@@ -633,29 +640,31 @@ public class ClassValidator implements C
      * @param groups
      * @return {@link GroupValidationContext} instance
      */
-    protected <T> GroupValidationContext<T> createContext(MetaBean metaBean, T object, Class<T> objectClass, Class<?>... groups) {
+    protected <T> GroupValidationContext<T> createContext(MetaBean metaBean, T object, Class<T> objectClass,
+        Class<?>... groups) {
         final ConstraintValidationListener<T> listener = new ConstraintValidationListener<T>(object, objectClass);
-        final GroupValidationContextImpl<T> context =
-            new GroupValidationContextImpl<T>(listener, factoryContext.getMessageInterpolator(),
-                factoryContext.getTraversableResolver(), factoryContext.getParameterNameProvider(),
-                factoryContext.getConstraintValidatorFactory(), metaBean);
+        final GroupValidationContextImpl<T> context = new GroupValidationContextImpl<T>(listener,
+            factoryContext.getMessageInterpolator(), factoryContext.getTraversableResolver(),
+            factoryContext.getParameterNameProvider(), factoryContext.getConstraintValidatorFactory(), metaBean);
         context.setBean(object, metaBean);
         context.setGroups(groupsComputer.computeGroups(groups));
         return context;
     }
 
-    protected <T> GroupValidationContext<T> createInvocableContext(MetaBean metaBean, T object, Class<T> objectClass, Class<?>... groups) {
+    protected <T> GroupValidationContext<T> createInvocableContext(MetaBean metaBean, T object, Class<T> objectClass,
+        Class<?>... groups) {
         final ConstraintValidationListener<T> listener = new ConstraintValidationListener<T>(object, objectClass);
-        final GroupValidationContextImpl<T> context =
-                new GroupValidationContextImpl<T>(listener, factoryContext.getMessageInterpolator(),
-                        factoryContext.getTraversableResolver(), factoryContext.getParameterNameProvider(),
-                        factoryContext.getConstraintValidatorFactory(), metaBean);
+        final GroupValidationContextImpl<T> context = new GroupValidationContextImpl<T>(listener,
+            factoryContext.getMessageInterpolator(), factoryContext.getTraversableResolver(),
+            factoryContext.getParameterNameProvider(), factoryContext.getConstraintValidatorFactory(), metaBean);
         context.setBean(object, metaBean);
         final Groups computedGroup = groupsComputer.computeGroups(groups);
-        if (Collections.singletonList(Group.DEFAULT).equals(computedGroup.getGroups()) && metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE) != null) {
+        if (Collections.singletonList(Group.DEFAULT).equals(computedGroup.getGroups())
+            && metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE) != null) {
             final Groups sequence = new Groups();
             @SuppressWarnings("unchecked")
-            final List<? extends Group> sequenceGroups = List.class.cast(metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE));
+            final List<? extends Group> sequenceGroups =
+                List.class.cast(metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE));
             sequence.getGroups().addAll(sequenceGroups);
             context.setGroups(sequence);
         } else {
@@ -699,13 +708,15 @@ public class ClassValidator implements C
     }
 
     @Override
-    public <T> Set<ConstraintViolation<T>> validateConstructorParameters(Constructor<? extends T> constructor, Object[] parameterValues, Class<?>... gps) {
+    public <T> Set<ConstraintViolation<T>> validateConstructorParameters(Constructor<? extends T> constructor,
+        Object[] parameterValues, Class<?>... gps) {
         notNull("Constructor", constructor);
         notNull("Groups", gps);
         notNull("Parameters", parameterValues);
 
         final Class<?> declaringClass = constructor.getDeclaringClass();
-        final ConstructorDescriptorImpl constructorDescriptor = ConstructorDescriptorImpl.class.cast(getConstraintsForClass(declaringClass).getConstraintsForConstructor(constructor.getParameterTypes()));
+        final ConstructorDescriptorImpl constructorDescriptor = ConstructorDescriptorImpl.class
+            .cast(getConstraintsForClass(declaringClass).getConstraintsForConstructor(constructor.getParameterTypes()));
         if (constructorDescriptor == null) { // no constraint
             return Collections.emptySet();
         }
@@ -713,32 +724,36 @@ public class ClassValidator implements C
         // sanity checks
         if (!constructorDescriptor.isValidated(constructor)) {
             if (parameterValues.length == 0) {
-                checkValidationAppliesTo(Collections.singleton(constructorDescriptor.getCrossParameterDescriptor()), ConstraintTarget.PARAMETERS);
+                checkValidationAppliesTo(Collections.singleton(constructorDescriptor.getCrossParameterDescriptor()),
+                    ConstraintTarget.PARAMETERS);
                 checkValidationAppliesTo(constructorDescriptor.getParameterDescriptors(), ConstraintTarget.PARAMETERS);
             } else {
-                checkValidationAppliesTo(Collections.singleton(constructorDescriptor.getCrossParameterDescriptor()), ConstraintTarget.IMPLICIT);
+                checkValidationAppliesTo(Collections.singleton(constructorDescriptor.getCrossParameterDescriptor()),
+                    ConstraintTarget.IMPLICIT);
                 checkValidationAppliesTo(constructorDescriptor.getParameterDescriptors(), ConstraintTarget.IMPLICIT);
             }
             constructorDescriptor.setValidated(constructor);
         }
 
         // validations
-        return validateInvocationParameters(constructor, parameterValues, constructorDescriptor, gps, new NodeImpl.ConstructorNodeImpl(declaringClass.getSimpleName(), Arrays.asList(constructor.getParameterTypes())), null);
+        return validateInvocationParameters(constructor, parameterValues, constructorDescriptor, gps,
+            new NodeImpl.ConstructorNodeImpl(declaringClass.getSimpleName(),
+                Arrays.asList(constructor.getParameterTypes())),
+            null);
     }
 
-    private <T> Set<ConstraintViolation<T>> validateInvocationParameters(final Member invocable, final Object[] parameterValues, final InvocableElementDescriptor constructorDescriptor,
-                                                                         final Class<?>[] gps, final NodeImpl rootNode, final Object rootBean) {
+    private <T> Set<ConstraintViolation<T>> validateInvocationParameters(final Member invocable,
+        final Object[] parameterValues, final InvocableElementDescriptor constructorDescriptor, final Class<?>[] gps,
+        final NodeImpl rootNode, final Object rootBean) {
         final Set<ConstraintViolation<T>> violations = new HashSet<ConstraintViolation<T>>();
 
         @SuppressWarnings("unchecked")
-        final GroupValidationContext<ConstraintValidationListener<?>> parametersContext =
-            createInvocableContext(constructorDescriptor.getMetaBean(), rootBean,
-                Class.class.cast(invocable.getDeclaringClass()), gps);
+        final GroupValidationContext<ConstraintValidationListener<?>> parametersContext = createInvocableContext(
+            constructorDescriptor.getMetaBean(), rootBean, Class.class.cast(invocable.getDeclaringClass()), gps);
 
         @SuppressWarnings("unchecked")
-        final GroupValidationContext<Object> crossParameterContext =
-            createContext(constructorDescriptor.getMetaBean(), rootBean,
-                Class.class.cast(invocable.getDeclaringClass()), gps);
+        final GroupValidationContext<Object> crossParameterContext = createContext(constructorDescriptor.getMetaBean(),
+            rootBean, Class.class.cast(invocable.getDeclaringClass()), gps);
 
         if (rootBean == null) {
             final Constructor<?> m = Constructor.class.cast(invocable);
@@ -753,7 +768,8 @@ public class ClassValidator implements C
         final Groups groups = parametersContext.getGroups();
 
         final List<ParameterDescriptor> parameterDescriptors = constructorDescriptor.getParameterDescriptors();
-        final ElementDescriptorImpl crossParamDescriptor = ElementDescriptorImpl.class.cast(constructorDescriptor.getCrossParameterDescriptor());
+        final ElementDescriptorImpl crossParamDescriptor =
+            ElementDescriptorImpl.class.cast(constructorDescriptor.getCrossParameterDescriptor());
         final Set<ConstraintDescriptor<?>> crossParamConstraints = crossParamDescriptor.getConstraintDescriptors();
 
         crossParameterContext.setBean(parameterValues);
@@ -766,7 +782,8 @@ public class ClassValidator implements C
 
         for (final Group current : groups.getGroups()) {
             for (int i = 0; i < parameterValues.length; i++) {
-                final ParameterDescriptorImpl paramDesc = ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
+                final ParameterDescriptorImpl paramDesc =
+                    ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
                 parametersContext.setBean(parameterValues[i]);
                 parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
                 for (final ConstraintDescriptor<?> constraintDescriptor : paramDesc.getConstraintDescriptors()) {
@@ -783,20 +800,23 @@ public class ClassValidator implements C
                 validation.validateGroupContext(crossParameterContext);
             }
 
-            if (gps.length == 0 && parametersContext.getListener().getConstraintViolations().size() + crossParameterContext.getListener().getConstraintViolations().size() > 0) {
+            if (gps.length == 0 && parametersContext.getListener().getConstraintViolations().size()
+                + crossParameterContext.getListener().getConstraintViolations().size() > 0) {
                 break;
             }
         }
 
         for (final Group current : groups.getGroups()) {
             for (int i = 0; i < parameterValues.length; i++) {
-                final ParameterDescriptorImpl paramDesc = ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
+                final ParameterDescriptorImpl paramDesc =
+                    ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
                 if (paramDesc.isCascaded() && parameterValues[i] != null) {
                     parametersContext.setBean(parameterValues[i]);
                     parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
                     initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(), parameterValues[i].getClass());
                     parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
-                    ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext), factoryContext.isTreatMapsLikeBeans());
+                    ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext),
+                        factoryContext.isTreatMapsLikeBeans());
                     parametersContext.moveUp(null, null);
                 }
             }
@@ -805,11 +825,13 @@ public class ClassValidator implements C
         for (final List<Group> eachSeq : groups.getSequences()) {
             for (final Group current : eachSeq) {
                 for (int i = 0; i < parameterValues.length; i++) {
-                    final ParameterDescriptorImpl paramDesc = ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
+                    final ParameterDescriptorImpl paramDesc =
+                        ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
                     parametersContext.setBean(parameterValues[i]);
                     parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
                     for (final ConstraintDescriptor<?> constraintDescriptor : paramDesc.getConstraintDescriptors()) {
-                        final ConstraintValidation<?> validation = ConstraintValidation.class.cast(constraintDescriptor);
+                        final ConstraintValidation<?> validation =
+                            ConstraintValidation.class.cast(constraintDescriptor);
                         parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
                         validation.validateGroupContext(parametersContext);
                     }
@@ -822,20 +844,24 @@ public class ClassValidator implements C
                     validation.validateGroupContext(crossParameterContext);
                 }
 
-                if (parametersContext.getListener().getConstraintViolations().size() + crossParameterContext.getListener().getConstraintViolations().size() > 0) {
+                if (parametersContext.getListener().getConstraintViolations().size()
+                    + crossParameterContext.getListener().getConstraintViolations().size() > 0) {
                     break;
                 }
             }
 
             for (final Group current : eachSeq) {
                 for (int i = 0; i < parameterValues.length; i++) {
-                    final ParameterDescriptorImpl paramDesc = ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
+                    final ParameterDescriptorImpl paramDesc =
+                        ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
                     if (paramDesc.isCascaded() && parameterValues[i] != null) {
                         parametersContext.setBean(parameterValues[i]);
                         parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
-                        initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(), parameterValues[i].getClass());
+                        initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(),
+                            parameterValues[i].getClass());
                         parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
-                        ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext), factoryContext.isTreatMapsLikeBeans());
+                        ValidationHelper.validateContext(parametersContext,
+                            new JsrValidationCallback(parametersContext), factoryContext.isTreatMapsLikeBeans());
                         parametersContext.moveUp(null, null);
                     }
                 }
@@ -843,16 +869,19 @@ public class ClassValidator implements C
         }
         if (constructorDescriptor.isCascaded()) {
             if (parametersContext.getValidatedValue() != null) {
-                initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(), parametersContext.getValidatedValue().getClass());
+                initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(),
+                    parametersContext.getValidatedValue().getClass());
 
                 for (final Group current : groups.getGroups()) {
                     parametersContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
-                    ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext), factoryContext.isTreatMapsLikeBeans());
+                    ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext),
+                        factoryContext.isTreatMapsLikeBeans());
                 }
                 for (final List<Group> eachSeq : groups.getSequences()) {
                     for (final Group current : eachSeq) {
                         parametersContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
-                        ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext), factoryContext.isTreatMapsLikeBeans());
+                        ValidationHelper.validateContext(parametersContext,
+                            new JsrValidationCallback(parametersContext), factoryContext.isTreatMapsLikeBeans());
                         if (!parametersContext.getListener().isEmpty()) {
                             break;
                         }
@@ -860,16 +889,19 @@ public class ClassValidator implements C
                 }
             }
             if (crossParameterContext.getValidatedValue() != null) {
-                initMetaBean(crossParameterContext, factoryContext.getMetaBeanFinder(), crossParameterContext.getValidatedValue().getClass());
+                initMetaBean(crossParameterContext, factoryContext.getMetaBeanFinder(),
+                    crossParameterContext.getValidatedValue().getClass());
 
                 for (final Group current : groups.getGroups()) {
                     crossParameterContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
-                    ValidationHelper.validateContext(crossParameterContext, new JsrValidationCallback(crossParameterContext), factoryContext.isTreatMapsLikeBeans());
+                    ValidationHelper.validateContext(crossParameterContext,
+                        new JsrValidationCallback(crossParameterContext), factoryContext.isTreatMapsLikeBeans());
                 }
                 for (final List<Group> eachSeq : groups.getSequences()) {
                     for (final Group current : eachSeq) {
                         crossParameterContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
-                        ValidationHelper.validateContext(crossParameterContext, new JsrValidationCallback(crossParameterContext), factoryContext.isTreatMapsLikeBeans());
+                        ValidationHelper.validateContext(crossParameterContext,
+                            new JsrValidationCallback(crossParameterContext), factoryContext.isTreatMapsLikeBeans());
                         if (!crossParameterContext.getListener().isEmpty()) {
                             break;
                         }
@@ -879,16 +911,19 @@ public class ClassValidator implements C
         }
 
         @SuppressWarnings("unchecked")
-        final Set<ConstraintViolation<T>> parameterViolations = Set.class.cast(parametersContext.getListener().getConstraintViolations());
+        final Set<ConstraintViolation<T>> parameterViolations =
+            Set.class.cast(parametersContext.getListener().getConstraintViolations());
         violations.addAll(parameterViolations);
         @SuppressWarnings("unchecked")
-        final Set<ConstraintViolation<T>> crossParameterViolations = Set.class.cast(crossParameterContext.getListener().getConstraintViolations());
+        final Set<ConstraintViolation<T>> crossParameterViolations =
+            Set.class.cast(crossParameterContext.getListener().getConstraintViolations());
         violations.addAll(crossParameterViolations);
 
         return violations;
     }
 
-    private static void checkValidationAppliesTo(final Collection<? extends ElementDescriptor> descriptors, final ConstraintTarget forbidden) {
+    private static void checkValidationAppliesTo(final Collection<? extends ElementDescriptor> descriptors,
+        final ConstraintTarget forbidden) {
         for (final ElementDescriptor descriptor : descriptors) {
             for (final ConstraintDescriptor<?> consDesc : descriptor.getConstraintDescriptors()) {
                 checkValidationAppliesTo(consDesc.getValidationAppliesTo(), forbidden);
@@ -896,7 +931,8 @@ public class ClassValidator implements C
         }
     }
 
-    private static void checkValidationAppliesTo(final Set<ConstraintDescriptor<?>> constraintDescriptors, final ConstraintTarget forbidden) {
+    private static void checkValidationAppliesTo(final Set<ConstraintDescriptor<?>> constraintDescriptors,
+        final ConstraintTarget forbidden) {
         for (final ConstraintDescriptor<?> descriptor : constraintDescriptors) {
             checkValidationAppliesTo(descriptor.getValidationAppliesTo(), forbidden);
         }
@@ -909,29 +945,35 @@ public class ClassValidator implements C
     }
 
     @Override
-    public <T> Set<ConstraintViolation<T>> validateConstructorReturnValue(final Constructor<? extends T> constructor, final T createdObject, final Class<?>... gps) {
+    public <T> Set<ConstraintViolation<T>> validateConstructorReturnValue(final Constructor<? extends T> constructor,
+        final T createdObject, final Class<?>... gps) {
         notNull("Constructor", constructor);
         notNull("Returned value", createdObject);
 
         final Class<? extends T> declaringClass = constructor.getDeclaringClass();
-        final ConstructorDescriptorImpl methodDescriptor = ConstructorDescriptorImpl.class.cast(getConstraintsForClass(declaringClass).getConstraintsForConstructor(constructor.getParameterTypes()));
+        final ConstructorDescriptorImpl methodDescriptor = ConstructorDescriptorImpl.class
+            .cast(getConstraintsForClass(declaringClass).getConstraintsForConstructor(constructor.getParameterTypes()));
         if (methodDescriptor == null) {
             throw new ValidationException("Constructor " + constructor + " doesn't belong to class " + declaringClass);
         }
 
-        return validateReturnedValue(new NodeImpl.ConstructorNodeImpl(declaringClass.getSimpleName(), Arrays.asList(constructor.getParameterTypes())), createdObject, declaringClass, methodDescriptor, gps, null);
+        return validateReturnedValue(
+            new NodeImpl.ConstructorNodeImpl(declaringClass.getSimpleName(),
+                Arrays.asList(constructor.getParameterTypes())),
+            createdObject, declaringClass, methodDescriptor, gps, null);
     }
 
-    private <T> Set<ConstraintViolation<T>> validateReturnedValue(final NodeImpl rootNode, final T createdObject, final Class<?> clazz,
-                                                                final InvocableElementDescriptor methodDescriptor, final Class<?>[] gps,
-                                                                final Object rootBean) {
-        final ElementDescriptorImpl returnedValueDescriptor = ElementDescriptorImpl.class.cast(methodDescriptor.getReturnValueDescriptor());
-        final Set<ConstraintDescriptor<?>> returnedValueConstraints = returnedValueDescriptor.getConstraintDescriptors();
+    private <T> Set<ConstraintViolation<T>> validateReturnedValue(final NodeImpl rootNode, final T createdObject,
+        final Class<?> clazz, final InvocableElementDescriptor methodDescriptor, final Class<?>[] gps,
+        final Object rootBean) {
+        final ElementDescriptorImpl returnedValueDescriptor =
+            ElementDescriptorImpl.class.cast(methodDescriptor.getReturnValueDescriptor());
+        final Set<ConstraintDescriptor<?>> returnedValueConstraints =
+            returnedValueDescriptor.getConstraintDescriptors();
 
         @SuppressWarnings("unchecked")
-        final GroupValidationContext<T> context =
-            createInvocableContext(methodDescriptor.getMetaBean(), createdObject,
-                Class.class.cast(Proxies.classFor(clazz)), gps);
+        final GroupValidationContext<T> context = createInvocableContext(methodDescriptor.getMetaBean(), createdObject,
+            Class.class.cast(Proxies.classFor(clazz)), gps);
         context.moveDown(rootNode);
         context.moveDown(new NodeImpl.ReturnValueNodeImpl());
         context.setReturnValue(rootBean);
@@ -956,7 +998,8 @@ public class ClassValidator implements C
                 initMetaBean(context, factoryContext.getMetaBeanFinder(), context.getValidatedValue().getClass());
 
                 context.setCurrentGroup(methodDescriptor.mapGroup(current));
-                ValidationHelper.validateContext(context, new JsrValidationCallback(context), factoryContext.isTreatMapsLikeBeans());
+                ValidationHelper.validateContext(context, new JsrValidationCallback(context),
+                    factoryContext.isTreatMapsLikeBeans());
 
                 if (currentViolationNumber < context.getListener().getConstraintViolations().size()) {
                     break;
@@ -983,7 +1026,8 @@ public class ClassValidator implements C
                     initMetaBean(context, factoryContext.getMetaBeanFinder(), context.getValidatedValue().getClass());
 
                     context.setCurrentGroup(methodDescriptor.mapGroup(current));
-                    ValidationHelper.validateContext(context, new JsrValidationCallback(context), factoryContext.isTreatMapsLikeBeans());
+                    ValidationHelper.validateContext(context, new JsrValidationCallback(context),
+                        factoryContext.isTreatMapsLikeBeans());
 
                     if (currentViolationNumber < context.getListener().getConstraintViolations().size()) {
                         break;
@@ -996,7 +1040,8 @@ public class ClassValidator implements C
     }
 
     @Override
-    public <T> Set<ConstraintViolation<T>> validateParameters(T object, Method method, Object[] parameterValues, Class<?>... groups) {
+    public <T> Set<ConstraintViolation<T>> validateParameters(T object, Method method, Object[] parameterValues,
+        Class<?>... groups) {
         notNull("Object", object);
         notNull("Parameters", parameterValues);
         notNull("Method", method);
@@ -1006,7 +1051,8 @@ public class ClassValidator implements C
         }
 
         final MethodDescriptorImpl methodDescriptor = findMethodDescriptor(object, method);
-        if (methodDescriptor == null || !(methodDescriptor.hasConstrainedParameters() || methodDescriptor.hasConstrainedReturnValue())) { // no constraint
+        if (methodDescriptor == null
+            || !(methodDescriptor.hasConstrainedParameters() || methodDescriptor.hasConstrainedReturnValue())) { // no constraint
             return Collections.emptySet();
         }
 
@@ -1037,7 +1083,8 @@ public class ClassValidator implements C
      * {@inheritDoc}
      */
     @Override
-    public <T> Set<ConstraintViolation<T>> validateReturnValue(T object, Method method, Object returnValue, Class<?>... groups) {
+    public <T> Set<ConstraintViolation<T>> validateReturnValue(T object, Method method, Object returnValue,
+        Class<?>... groups) {
         notNull("object", object);
         notNull("method", method);
         notNull("groups", groups);
@@ -1048,24 +1095,25 @@ public class ClassValidator implements C
         }
 
         if (method.getReturnType() == Void.TYPE) {
-            checkValidationAppliesTo(methodDescriptor.getReturnValueDescriptor().getConstraintDescriptors(), ConstraintTarget.RETURN_VALUE);
+            checkValidationAppliesTo(methodDescriptor.getReturnValueDescriptor().getConstraintDescriptors(),
+                ConstraintTarget.RETURN_VALUE);
         }
 
         @SuppressWarnings("unchecked")
-        final Set<ConstraintViolation<T>> result =
-            Set.class.cast(validateReturnedValue(
-                new NodeImpl.MethodNodeImpl(method.getName(), Arrays.asList(method.getParameterTypes())), returnValue,
-                object.getClass(), methodDescriptor, groups, object));
+        final Set<ConstraintViolation<T>> result = Set.class.cast(validateReturnedValue(
+            new NodeImpl.MethodNodeImpl(method.getName(), Arrays.asList(method.getParameterTypes())), returnValue,
+            object.getClass(), methodDescriptor, groups, object));
         return result;
     }
 
     private <T> MethodDescriptorImpl findMethodDescriptor(final T object, final Method method) {
-        return MethodDescriptorImpl.class.cast(
-            BeanDescriptorImpl.class.cast(getConstraintsForClass(Proxies.classFor(method.getDeclaringClass())))
+        return MethodDescriptorImpl.class
+            .cast(BeanDescriptorImpl.class.cast(getConstraintsForClass(Proxies.classFor(method.getDeclaringClass())))
                 .getInternalConstraintsForMethod(method.getName(), method.getParameterTypes()));
     }
 
-    private <T> void initMetaBean(final GroupValidationContext<T> context, final MetaBeanFinder metaBeanFinder, final Class<?> directValueClass) {
+    private <T> void initMetaBean(final GroupValidationContext<T> context, final MetaBeanFinder metaBeanFinder,
+        final Class<?> directValueClass) {
         if (directValueClass.isArray()) {
             context.setMetaBean(metaBeanFinder.findForClass(directValueClass.getComponentType()));
             return;

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConfigurationImpl.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConfigurationImpl.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConfigurationImpl.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConfigurationImpl.java Tue Oct 25 15:34:35 2016
@@ -93,11 +93,12 @@ public class ConfigurationImpl implement
     protected volatile ParameterNameProvider parameterNameProvider = defaultParameterNameProvider;
     protected Class<? extends ParameterNameProvider> parameterNameProviderClass = null;
 
-    protected BootstrapConfiguration  bootstrapConfiguration;
+    protected BootstrapConfiguration bootstrapConfiguration;
 
     protected Collection<ExecutableType> executableValidation;
 
-    private Collection<BValExtension.Releasable<?>> releasables = new CopyOnWriteArrayList<BValExtension.Releasable<?>>();
+    private Collection<BValExtension.Releasable<?>> releasables =
+        new CopyOnWriteArrayList<BValExtension.Releasable<?>>();
 
     private boolean beforeCdi = false;
 
@@ -182,8 +183,7 @@ public class ConfigurationImpl implement
      * {@inheritDoc}
      */
     @Override
-    public ConfigurationImpl constraintValidatorFactory(
-          ConstraintValidatorFactory constraintFactory) {
+    public ConfigurationImpl constraintValidatorFactory(ConstraintValidatorFactory constraintFactory) {
         if (constraintFactory == null) {
             return this;
         }
@@ -321,7 +321,7 @@ public class ConfigurationImpl implement
      */
     @Override
     public ValidatorFactory buildValidatorFactory() {
-            return doBuildValidatorFactory();
+        return doBuildValidatorFactory();
     }
 
     @Privileged
@@ -354,7 +354,8 @@ public class ConfigurationImpl implement
 
     /** Check whether a validation.xml file exists and parses it with JAXB */
     private ValidationParser parseValidationXml() {
-        return ValidationParser.processValidationConfig(getProperties().get(Properties.VALIDATION_XML_PATH), this, ignoreXmlConfiguration);
+        return ValidationParser.processValidationConfig(getProperties().get(Properties.VALIDATION_XML_PATH), this,
+            ignoreXmlConfiguration);
     }
 
     /**
@@ -367,9 +368,11 @@ public class ConfigurationImpl implement
             return constraintValidatorFactory;
         }
 
-        if (constraintValidatorFactory == defaultConstraintValidatorFactory && constraintValidatorFactoryClass != null) {
+        if (constraintValidatorFactory == defaultConstraintValidatorFactory
+            && constraintValidatorFactoryClass != null) {
             synchronized (this) {
-                if (constraintValidatorFactory == defaultConstraintValidatorFactory && constraintValidatorFactoryClass != null) {
+                if (constraintValidatorFactory == defaultConstraintValidatorFactory
+                    && constraintValidatorFactoryClass != null) {
                     constraintValidatorFactory = newInstance(constraintValidatorFactoryClass);
                 }
             }
@@ -423,7 +426,7 @@ public class ConfigurationImpl implement
     private ValidationProvider<?> findProvider() {
         if (providerClass == null) {
             return providerResolver.getValidationProviders().get(0);
-        } 
+        }
         for (ValidationProvider<?> provider : providerResolver.getValidationProviders()) {
             if (providerClass.isAssignableFrom(provider.getClass())) {
                 return provider;

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintAnnotationAttributes.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintAnnotationAttributes.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintAnnotationAttributes.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintAnnotationAttributes.java Tue Oct 25 15:34:35 2016
@@ -146,7 +146,8 @@ public enum ConstraintAnnotationAttribut
 
     // this is static but related to Worker
     private static final ConcurrentMap<Class<?>, Worker<?>> WORKER_CACHE = new ConcurrentHashMap<Class<?>, Worker<?>>();
-    private static final ConcurrentMap<Class<?>, ConcurrentMap<String, Method>> METHOD_BY_NAME_AND_CLASS = new ConcurrentHashMap<Class<?>, ConcurrentMap<String, Method>>();
+    private static final ConcurrentMap<Class<?>, ConcurrentMap<String, Method>> METHOD_BY_NAME_AND_CLASS =
+        new ConcurrentHashMap<Class<?>, ConcurrentMap<String, Method>>();
     private static final Method NULL_METHOD;
     static {
         try {

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDefaults.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDefaults.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDefaults.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDefaults.java Tue Oct 25 15:34:35 2016
@@ -44,7 +44,7 @@ import org.apache.commons.weaver.privili
 public class ConstraintDefaults {
     private static final Logger log = Logger.getLogger(ConstraintDefaults.class.getName());
     private static final String DEFAULT_CONSTRAINTS = "org/apache/bval/jsr/DefaultConstraints.properties";
-    
+
     /**
      * The default constraint data stored herein.
      */
@@ -72,7 +72,7 @@ public class ConstraintDefaults {
      */
     @SuppressWarnings("unchecked")
     public <A extends Annotation> Class<? extends ConstraintValidator<A, ?>>[] getValidatorClasses(
-          Class<A> annotationType) {
+        Class<A> annotationType) {
         return (Class<? extends ConstraintValidator<A, ?>>[]) getDefaultConstraints().get(annotationType.getName());
     }
 

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDescriptorImpl.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDescriptorImpl.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDescriptorImpl.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDescriptorImpl.java Tue Oct 25 15:34:35 2016
@@ -56,9 +56,10 @@ public class ConstraintDescriptorImpl<T
      * @param descriptor
      */
     public ConstraintDescriptorImpl(final ConstraintDescriptor<T> descriptor) {
-        this(descriptor.getAnnotation(), descriptor.getGroups(), descriptor.getPayload(), descriptor
-            .getConstraintValidatorClasses(), descriptor.getAttributes(), descriptor.getComposingConstraints(),
-            descriptor.isReportAsSingleViolation(), descriptor.getValidationAppliesTo(), descriptor.getMessageTemplate());
+        this(descriptor.getAnnotation(), descriptor.getGroups(), descriptor.getPayload(),
+            descriptor.getConstraintValidatorClasses(), descriptor.getAttributes(),
+            descriptor.getComposingConstraints(), descriptor.isReportAsSingleViolation(),
+            descriptor.getValidationAppliesTo(), descriptor.getMessageTemplate());
     }
 
     /**
@@ -155,30 +156,50 @@ public class ConstraintDescriptorImpl<T
         return reportAsSingleViolation;
     }
 
-
     /**
      * generated equals on all fields except hashCode
      */
     @Override
     public boolean equals(Object o) {
-        if (this == o) { return true; }
-        if (o == null || getClass() != o.getClass()) { return false; }
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
 
         ConstraintDescriptorImpl<?> that = (ConstraintDescriptorImpl<?>) o;
 
-        if (reportAsSingleViolation != that.reportAsSingleViolation) { return false; }
-        if (annotation != null ? !annotation.equals(that.annotation) : that.annotation != null) { return false; }
-        if (groups != null ? !groups.equals(that.groups) : that.groups != null) { return false; }
-        if (payload != null ? !payload.equals(that.payload) : that.payload != null) { return false; }
-        if (constraintValidatorClasses != null ? !constraintValidatorClasses.equals(that.constraintValidatorClasses) : that.constraintValidatorClasses != null) { return false; }
-        if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) { return false; }
-        if (composingConstraints != null ? !composingConstraints.equals(that.composingConstraints) : that.composingConstraints != null) { return false; }
-        if (validationAppliesTo != that.validationAppliesTo) { return false; }
+        if (reportAsSingleViolation != that.reportAsSingleViolation) {
+            return false;
+        }
+        if (annotation != null ? !annotation.equals(that.annotation) : that.annotation != null) {
+            return false;
+        }
+        if (groups != null ? !groups.equals(that.groups) : that.groups != null) {
+            return false;
+        }
+        if (payload != null ? !payload.equals(that.payload) : that.payload != null) {
+            return false;
+        }
+        if (constraintValidatorClasses != null ? !constraintValidatorClasses.equals(that.constraintValidatorClasses)
+            : that.constraintValidatorClasses != null) {
+            return false;
+        }
+        if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) {
+            return false;
+        }
+        if (composingConstraints != null ? !composingConstraints.equals(that.composingConstraints)
+            : that.composingConstraints != null) {
+            return false;
+        }
+        if (validationAppliesTo != that.validationAppliesTo) {
+            return false;
+        }
         return template != null ? template.equals(that.template) : that.template == null;
 
     }
 
-
     @Override
     public int hashCode() {
         return hashCode;

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintFinderImpl.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintFinderImpl.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintFinderImpl.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintFinderImpl.java Tue Oct 25 15:34:35 2016
@@ -66,7 +66,7 @@ final class ConstraintFinderImpl impleme
         for (Group group : groupChain.getGroups()) {
             if (group.isDefault()) {
                 // If group is default, check if it gets redefined
-                for (Group defaultGroupMember : metaBean.<List<Group>>getFeature(JsrFeatures.Bean.GROUP_SEQUENCE)) {
+                for (Group defaultGroupMember : metaBean.<List<Group>> getFeature(JsrFeatures.Bean.GROUP_SEQUENCE)) {
                     for (ConstraintValidation<?> descriptor : constraintDescriptors) {
                         if (isInScope(descriptor) && isInGroup(descriptor, defaultGroupMember)) {
                             matchingDescriptors.add(descriptor);
@@ -122,24 +122,23 @@ final class ConstraintFinderImpl impleme
     }
 
     private boolean isInScope(ConstraintValidation<?> descriptor) {
-        if (findInScopes.size() == Scope.values().length)
-         {
+        if (findInScopes.size() == Scope.values().length) {
             return true; // all scopes
         }
         if (metaBean != null) {
             final boolean isOwner = descriptor.getOwner().equals(metaBean.getBeanClass());
             for (Scope scope : findInScopes) {
                 switch (scope) {
-                    case LOCAL_ELEMENT:
-                        if (isOwner) {
-                            return true;
-                        }
-                        break;
-                    case HIERARCHY:
-                        if (!isOwner) {
-                            return true;
-                        }
-                        break;
+                case LOCAL_ELEMENT:
+                    if (isOwner) {
+                        return true;
+                    }
+                    break;
+                case HIERARCHY:
+                    if (!isOwner) {
+                        return true;
+                    }
+                    break;
                 }
             }
         }

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java Tue Oct 25 15:34:35 2016
@@ -80,9 +80,8 @@ public class ConstraintValidation<T exte
     private Class<? extends ConstraintValidator<T, ?>>[] validatorClasses;
     private ConstraintTarget validationAppliesTo = null;
 
-    public ConstraintValidation(Class<? extends ConstraintValidator<T, ?>>[] validatorClasses,
-                                T annotation, Class<?> owner, AccessStrategy access,
-                                boolean reportFromComposite, ConstraintTarget target) {
+    public ConstraintValidation(Class<? extends ConstraintValidator<T, ?>>[] validatorClasses, T annotation,
+        Class<?> owner, AccessStrategy access, boolean reportFromComposite, ConstraintTarget target) {
         this.attributes = new HashMap<String, Object>();
         this.validatorClasses = validatorClasses != null ? validatorClasses.clone() : null;
         this.annotation = annotation;
@@ -156,8 +155,8 @@ public class ConstraintValidation<T exte
             synchronized (this) {
                 if (validator == null) {
                     try {
-                        validator = getConstraintValidator(
-                                context.getConstraintValidatorFactory(), annotation, validatorClasses, owner, access);
+                        validator = getConstraintValidator(context.getConstraintValidatorFactory(), annotation,
+                            validatorClasses, owner, access);
                         if (validator != null) {
                             validator.initialize(annotation);
                         }
@@ -235,7 +234,7 @@ public class ConstraintValidation<T exte
     }
 
     private <A extends Annotation> ConstraintValidator<A, ? super T> getConstraintValidator(
-            ConstraintValidatorFactory factory, A annotation,
+        ConstraintValidatorFactory factory, A annotation,
         Class<? extends ConstraintValidator<A, ?>>[] constraintClasses, Class<?> owner, AccessStrategy access) {
         if (ObjectUtils.isNotEmpty(constraintClasses)) {
             final Type type = determineTargetedType(owner, access);
@@ -248,7 +247,8 @@ public class ConstraintValidation<T exte
              * T and not a supertype of the chosen ConstraintValidator supported
              * type.
              */
-            final Map<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> validatorTypes = getValidatorsTypes(constraintClasses);
+            final Map<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> validatorTypes =
+                getValidatorsTypes(constraintClasses);
             reduceTarget(validatorTypes, access);
 
             final List<Type> assignableTypes = new ArrayList<Type>(constraintClasses.length);
@@ -262,7 +262,8 @@ public class ConstraintValidation<T exte
                     "Only a validator for Object or Object[] should be provided for cross-parameter validators");
             }
 
-            final Collection<Class<? extends ConstraintValidator<A, ?>>> key = validatorTypes.get(assignableTypes.get(0));
+            final Collection<Class<? extends ConstraintValidator<A, ?>>> key =
+                validatorTypes.get(assignableTypes.get(0));
             if (key.size() > 1) {
                 final String message = "Factory returned " + key.size() + " validators";
                 if (ParametersAccess.class.isInstance(access)) { // cross parameter
@@ -272,7 +273,8 @@ public class ConstraintValidation<T exte
             }
 
             @SuppressWarnings("unchecked")
-            final ConstraintValidator<A, ? super T> validator = (ConstraintValidator<A, ? super T>) factory.getInstance(key.iterator().next());
+            final ConstraintValidator<A, ? super T> validator =
+                (ConstraintValidator<A, ? super T>) factory.getInstance(key.iterator().next());
             if (validator == null) {
                 throw new ValidationException("Factory returned null validator for: " + key);
 
@@ -283,8 +285,11 @@ public class ConstraintValidation<T exte
         return null;
     }
 
-    private <A extends Annotation> void reduceTarget(final Map<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> validator, final AccessStrategy access) {
-        for (final Map.Entry<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> entry : validator.entrySet()) {
+    private <A extends Annotation> void reduceTarget(
+        final Map<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> validator,
+        final AccessStrategy access) {
+        for (final Map.Entry<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> entry : validator
+            .entrySet()) {
             final Collection<Class<? extends ConstraintValidator<A, ?>>> validators = entry.getValue();
             final Iterator<Class<? extends ConstraintValidator<A, ?>>> it = validators.iterator();
             while (it.hasNext()) {
@@ -297,7 +302,8 @@ public class ConstraintValidation<T exte
                 final SupportedValidationTarget target = clazz.getAnnotation(SupportedValidationTarget.class);
                 if (target != null) {
                     final Collection<ValidationTarget> targets = Arrays.asList(target.value());
-                    final boolean isParameter = ParameterAccess.class.isInstance(access) || ParametersAccess.class.isInstance(access);
+                    final boolean isParameter =
+                        ParameterAccess.class.isInstance(access) || ParametersAccess.class.isInstance(access);
                     if ((isParameter && !targets.contains(ValidationTarget.PARAMETERS))
                         || (!isParameter && !targets.contains(ValidationTarget.ANNOTATED_ELEMENT))) {
                         it.remove();
@@ -314,23 +320,25 @@ public class ConstraintValidation<T exte
         AccessStrategy access) {
 
         if (types.isEmpty()) {
-            final String message = "No validator could be found for type " + stringForType(targetType)
-                + ". See: @" + anno.annotationType().getSimpleName() + " at " + stringForLocation(owner, access);
+            final String message = "No validator could be found for type " + stringForType(targetType) + ". See: @"
+                + anno.annotationType().getSimpleName() + " at " + stringForLocation(owner, access);
             if (Object[].class.equals(targetType)) { // cross parameter
                 throw new ConstraintDefinitionException(message);
             }
             throw new UnexpectedTypeException(message);
         }
         if (types.size() > 1) {
-            throw new UnexpectedTypeException(String.format(
-                "Ambiguous validators for type %s. See: @%s at %s. Validators are: %s", stringForType(targetType), anno
-                    .annotationType().getSimpleName(), stringForLocation(owner, access), StringUtils.join(types, ", ")));
+            throw new UnexpectedTypeException(
+                String.format("Ambiguous validators for type %s. See: @%s at %s. Validators are: %s",
+                    stringForType(targetType), anno.annotationType().getSimpleName(), stringForLocation(owner, access),
+                    StringUtils.join(types, ", ")));
         }
     }
 
     private static String stringForType(Type clazz) {
         if (clazz instanceof Class<?>) {
-            return ((Class<?>) clazz).isArray() ? ((Class<?>) clazz).getComponentType().getName() + "[]" : ((Class<?>) clazz).getName();
+            return ((Class<?>) clazz).isArray() ? ((Class<?>) clazz).getComponentType().getName() + "[]"
+                : ((Class<?>) clazz).getName();
         }
         return clazz.toString();
     }
@@ -380,9 +388,8 @@ public class ConstraintValidation<T exte
         final Map<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> validatorsTypes =
             new HashMap<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>>();
         for (Class<? extends ConstraintValidator<A, ?>> validatorType : constraintValidatorClasses) {
-            Type validatedType =
-                TypeUtils.getTypeArguments(validatorType, ConstraintValidator.class).get(
-                    ConstraintValidator.class.getTypeParameters()[1]);
+            Type validatedType = TypeUtils.getTypeArguments(validatorType, ConstraintValidator.class)
+                .get(ConstraintValidator.class.getTypeParameters()[1]);
             if (validatedType == null) {
                 throw new ValidationException(String.format("Could not detect validated type for %s", validatorType));
             }
@@ -428,9 +435,10 @@ public class ConstraintValidation<T exte
                 // Either a "legit" problem initializing the validator or a
                 // ClassCastException if the validator associated annotation is
                 // not a supertype of the validated annotation.
-                throw new ConstraintDefinitionException("Incorrect validator ["
-                    + validator.getClass().getCanonicalName() + "] for annotation "
-                    + annotation.annotationType().getCanonicalName(), e);
+                throw new ConstraintDefinitionException(
+                    "Incorrect validator [" + validator.getClass().getCanonicalName() + "] for annotation "
+                        + annotation.annotationType().getCanonicalName(),
+                    e);
             }
         }
     }
@@ -558,7 +566,8 @@ public class ConstraintValidation<T exte
      */
     @Override
     public List<Class<? extends ConstraintValidator<T, ?>>> getConstraintValidatorClasses() {
-        return validatorClasses == null ? Collections.<Class<? extends ConstraintValidator<T, ?>>> emptyList() : Arrays.asList(validatorClasses);
+        return validatorClasses == null ? Collections.<Class<? extends ConstraintValidator<T, ?>>> emptyList()
+            : Arrays.asList(validatorClasses);
     }
 
     public void setValidationAppliesTo(final ConstraintTarget validationAppliesTo) {

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidationListener.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidationListener.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidationListener.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidationListener.java Tue Oct 25 15:34:35 2016
@@ -16,7 +16,6 @@
  */
 package org.apache.bval.jsr;
 
-
 import org.apache.bval.jsr.util.PathImpl;
 import org.apache.bval.model.ValidationContext;
 import org.apache.bval.model.ValidationListener;
@@ -74,8 +73,7 @@ public final class ConstraintValidationL
         }
     }
 
-    private void addError(String messageTemplate, Path propPath,
-                          ValidationContext<?> context) {
+    private void addError(String messageTemplate, Path propPath, ValidationContext<?> context) {
         if (compositeDepth > 0) {
             hasCompositeError |= true;
             return;
@@ -88,18 +86,19 @@ public final class ConstraintValidationL
             GroupValidationContext<?> gcontext = (GroupValidationContext<?>) context;
             value = gcontext.getValidatedValue();
             if (gcontext instanceof MessageInterpolator.Context) {
-                message = gcontext.getMessageResolver()
-                      .interpolate(messageTemplate,
-                            (MessageInterpolator.Context) gcontext);
-            } else {
                 message =
-                      gcontext.getMessageResolver().interpolate(messageTemplate, null);
+                    gcontext.getMessageResolver().interpolate(messageTemplate, (MessageInterpolator.Context) gcontext);
+            } else {
+                message = gcontext.getMessageResolver().interpolate(messageTemplate, null);
             }
             descriptor = gcontext.getConstraintValidation().asSerializableDescriptor();
-            if (propPath == null) propPath = gcontext.getPropertyPath();
+            if (propPath == null)
+                propPath = gcontext.getPropertyPath();
         } else {
-            if (context.getMetaProperty() == null) value = context.getBean();
-            else value = context.getPropertyValue();
+            if (context.getMetaProperty() == null)
+                value = context.getBean();
+            else
+                value = context.getPropertyValue();
             message = messageTemplate;
             if (propPath == null)
                 propPath = PathImpl.createPathFromString(context.getPropertyName());
@@ -147,9 +146,8 @@ public final class ConstraintValidationL
             }
 
             if (ElementKind.CONSTRUCTOR.equals(kind)
-                    && (ElementKind.CROSS_PARAMETER.equals(elementKind)
-                        || ElementKind.PARAMETER.equals(elementKind))
-                    && (it.hasNext() && it.next() != null && it.hasNext() && it.next() != null && !it.hasNext())) { // means inherited validation use real value
+                && (ElementKind.CROSS_PARAMETER.equals(elementKind) || ElementKind.PARAMETER.equals(elementKind))
+                && (it.hasNext() && it.next() != null && it.hasNext() && it.next() != null && !it.hasNext())) { // means inherited validation use real value
                 leaf = null;
             }
 
@@ -161,12 +159,8 @@ public final class ConstraintValidationL
             rootBean = this.rootBean;
         }
 
-        constraintViolations.add(new ConstraintViolationImpl<T>(
-                messageTemplate, message,
-                rootBean, leaf,
-                propPath, value, descriptor,
-                rootBeanType,
-                elementType, returnValue, parameters));
+        constraintViolations.add(new ConstraintViolationImpl<T>(messageTemplate, message, rootBean, leaf, propPath,
+            value, descriptor, rootBeanType, elementType, returnValue, parameters));
     }
 
     private static boolean kindOf(final Path propPath, final ElementKind... kinds) {
@@ -216,7 +210,7 @@ public final class ConstraintValidationL
     public Class<T> getRootBeanType() {
         return rootBeanType;
     }
-    
+
     /**
      * Get the count of encountered violations.
      * @return int
@@ -249,7 +243,7 @@ public final class ConstraintValidationL
      */
     public boolean endReportAsSingle() {
         boolean endOutMostReportAsSingle = (--compositeDepth == 0);
-        if( endOutMostReportAsSingle ) {
+        if (endOutMostReportAsSingle) {
             hasCompositeError = false;
         }
         return endOutMostReportAsSingle;

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorContextImpl.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorContextImpl.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorContextImpl.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorContextImpl.java Tue Oct 25 15:34:35 2016
@@ -18,7 +18,6 @@
  */
 package org.apache.bval.jsr;
 
-
 import org.apache.bval.jsr.util.LeafNodeBuilderCustomizableContextImpl;
 import org.apache.bval.jsr.util.NodeBuilderDefinedContextImpl;
 import org.apache.bval.jsr.util.NodeImpl;
@@ -40,8 +39,7 @@ import java.util.List;
  * a {@link ConstraintValidation} to its adapted {@link ConstraintValidator}. <br/>
  */
 public class ConstraintValidatorContextImpl implements ConstraintValidatorContext {
-    private final List<ValidationListener.Error> errorMessages =
-          new LinkedList<ValidationListener.Error>();
+    private final List<ValidationListener.Error> errorMessages = new LinkedList<ValidationListener.Error>();
 
     private final ConstraintValidation<?> constraintDescriptor;
     private final GroupValidationContext<?> validationContext;
@@ -54,7 +52,7 @@ public class ConstraintValidatorContextI
      * @param aConstraintValidation
      */
     public ConstraintValidatorContextImpl(GroupValidationContext<?> validationContext,
-                                          ConstraintValidation<?> aConstraintValidation) {
+        ConstraintValidation<?> aConstraintValidation) {
         this.validationContext = validationContext;
         this.constraintDescriptor = aConstraintValidation;
     }
@@ -79,8 +77,7 @@ public class ConstraintValidatorContextI
      * {@inheritDoc}
      */
     @Override
-    public ConstraintViolationBuilder buildConstraintViolationWithTemplate(
-          String messageTemplate) {
+    public ConstraintViolationBuilder buildConstraintViolationWithTemplate(String messageTemplate) {
         return new ConstraintViolationBuilderImpl(this, messageTemplate, validationContext.getPropertyPath());
     }
 
@@ -93,7 +90,7 @@ public class ConstraintValidatorContextI
     }
 
     private static final class ConstraintViolationBuilderImpl
-          implements ConstraintValidatorContext.ConstraintViolationBuilder {
+        implements ConstraintValidatorContext.ConstraintViolationBuilder {
         private final ConstraintValidatorContextImpl parent;
         private final String messageTemplate;
         private final PathImpl propertyPath;
@@ -104,8 +101,7 @@ public class ConstraintValidatorContextI
          * @param template
          * @param path
          */
-        ConstraintViolationBuilderImpl(ConstraintValidatorContextImpl contextImpl,
-                                       String template, PathImpl path) {
+        ConstraintViolationBuilderImpl(ConstraintValidatorContextImpl contextImpl, String template, PathImpl path) {
             parent = contextImpl;
             messageTemplate = template;
             propertyPath = path;
@@ -157,7 +153,8 @@ public class ConstraintValidatorContextI
         @Override
         public NodeBuilderDefinedContext addParameterNode(int index) {
             final Method method = parent.validationContext.getMethod();
-            final List<String> parameters = parent.validationContext.getParameterNameProvider().getParameterNames(method);
+            final List<String> parameters =
+                parent.validationContext.getParameterNameProvider().getParameterNames(method);
             final NodeImpl node = new NodeImpl.ParameterNodeImpl(parameters.get(index), index);
             node.setParameterIndex(index);
             node.setKind(ElementKind.PARAMETER);
@@ -185,15 +182,13 @@ public class ConstraintValidatorContextI
     public List<ValidationListener.Error> getErrorMessages() {
         if (defaultDisabled && errorMessages.isEmpty()) {
             throw new ValidationException(
-                  "At least one custom message must be created if the default error message gets disabled.");
+                "At least one custom message must be created if the default error message gets disabled.");
         }
 
-        List<ValidationListener.Error> returnedErrorMessages =
-              new ArrayList<ValidationListener.Error>(errorMessages);
+        List<ValidationListener.Error> returnedErrorMessages = new ArrayList<ValidationListener.Error>(errorMessages);
         if (!defaultDisabled) {
-            returnedErrorMessages.add(new ValidationListener.Error(
-                  getDefaultConstraintMessageTemplate(), validationContext.getPropertyPath(),
-                  null));
+            returnedErrorMessages.add(new ValidationListener.Error(getDefaultConstraintMessageTemplate(),
+                validationContext.getPropertyPath(), null));
         }
         return returnedErrorMessages;
     }

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorIdentity.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorIdentity.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorIdentity.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorIdentity.java Tue Oct 25 15:34:35 2016
@@ -122,12 +122,9 @@ final class ConstraintValidatorIdentity
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result
-                + ((this.bean == null) ? 0 : this.bean.hashCode());
-        result = prime * result
-                + ((this.path == null) ? 0 : this.path.hashCode());
-        result = prime * result
-                + ((this.constraintValidator == null) ? 0 : this.constraintValidator.hashCode());
+        result = prime * result + ((this.bean == null) ? 0 : this.bean.hashCode());
+        result = prime * result + ((this.path == null) ? 0 : this.path.hashCode());
+        result = prime * result + ((this.constraintValidator == null) ? 0 : this.constraintValidator.hashCode());
         return result;
     }
 

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java Tue Oct 25 15:34:35 2016
@@ -62,9 +62,8 @@ class ConstraintViolationImpl<T> impleme
      * @param parameters
      */
     public ConstraintViolationImpl(String messageTemplate, String message, T rootBean, Object leafBean,
-                                   Path propertyPath, Object value,
-                                   ConstraintDescriptor<?> constraintDescriptor, Class<T> rootBeanClass,
-                                   ElementType elementType, Object returnValue, Object[] parameters) {
+        Path propertyPath, Object value, ConstraintDescriptor<?> constraintDescriptor, Class<T> rootBeanClass,
+        ElementType elementType, Object returnValue, Object[] parameters) {
         this.messageTemplate = messageTemplate;
         this.message = message;
         this.rootBean = rootBean;
@@ -172,33 +171,43 @@ class ConstraintViolationImpl<T> impleme
      */
     @Override
     public String toString() {
-        return "ConstraintViolationImpl{" + "rootBean=" + rootBean + ", propertyPath='" +
-              propertyPath + '\'' + ", message='" + message + '\'' + ", leafBean=" +
-              leafBean + ", value=" + value + '}';
+        return "ConstraintViolationImpl{" + "rootBean=" + rootBean + ", propertyPath='" + propertyPath + '\''
+            + ", message='" + message + '\'' + ", leafBean=" + leafBean + ", value=" + value + '}';
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
 
         ConstraintViolationImpl that = (ConstraintViolationImpl) o;
 
-        if (constraintDescriptor != null ? !constraintDescriptor.equals(that.constraintDescriptor) : that.constraintDescriptor != null)
+        if (constraintDescriptor != null ? !constraintDescriptor.equals(that.constraintDescriptor)
+            : that.constraintDescriptor != null)
+            return false;
+        if (elementType != that.elementType)
+            return false;
+        if (leafBean != null ? !leafBean.equals(that.leafBean) : that.leafBean != null)
+            return false;
+        if (message != null ? !message.equals(that.message) : that.message != null)
             return false;
-        if (elementType != that.elementType) return false;
-        if (leafBean != null ? !leafBean.equals(that.leafBean) : that.leafBean != null) return false;
-        if (message != null ? !message.equals(that.message) : that.message != null) return false;
         if (messageTemplate != null ? !messageTemplate.equals(that.messageTemplate) : that.messageTemplate != null)
             return false;
         // Probably incorrect - comparing Object[] arrays with Arrays.equals
-        if (!Arrays.equals(parameters, that.parameters)) return false;
-        if (propertyPath != null ? !propertyPath.equals(that.propertyPath) : that.propertyPath != null) return false;
-        if (returnValue != null ? !returnValue.equals(that.returnValue) : that.returnValue != null) return false;
-        if (rootBean != null ? !rootBean.equals(that.rootBean) : that.rootBean != null) return false;
+        if (!Arrays.equals(parameters, that.parameters))
+            return false;
+        if (propertyPath != null ? !propertyPath.equals(that.propertyPath) : that.propertyPath != null)
+            return false;
+        if (returnValue != null ? !returnValue.equals(that.returnValue) : that.returnValue != null)
+            return false;
+        if (rootBean != null ? !rootBean.equals(that.rootBean) : that.rootBean != null)
+            return false;
         if (rootBeanClass != null ? !rootBeanClass.equals(that.rootBeanClass) : that.rootBeanClass != null)
             return false;
-        if (value != null ? !value.equals(that.value) : that.value != null) return false;
+        if (value != null ? !value.equals(that.value) : that.value != null)
+            return false;
 
         return true;
     }

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstructorDescriptorImpl.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstructorDescriptorImpl.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstructorDescriptorImpl.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ConstructorDescriptorImpl.java Tue Oct 25 15:34:35 2016
@@ -16,7 +16,6 @@
  */
 package org.apache.bval.jsr;
 
-
 import org.apache.bval.model.MetaBean;
 import org.apache.bval.model.MetaConstructor;
 import org.apache.bval.model.Validation;
@@ -27,7 +26,7 @@ import javax.validation.metadata.Constru
  * Description: {@link javax.validation.metadata.ConstructorDescriptor} implementation.<br/>
  */
 public class ConstructorDescriptorImpl extends InvocableElementDescriptor
-      implements ConstructorDescriptor, ProcedureDescriptor {
+    implements ConstructorDescriptor, ProcedureDescriptor {
     /**
      * Create a new ConstructorDescriptorImpl instance.
      * @param metaBean

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultConstraintValidatorFactory.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultConstraintValidatorFactory.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultConstraintValidatorFactory.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultConstraintValidatorFactory.java Tue Oct 25 15:34:35 2016
@@ -28,12 +28,12 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.concurrent.CopyOnWriteArrayList;
 
-
 /**
  * Description: create constraint instances with the default / no-arg constructor <br/>
  */
 public class DefaultConstraintValidatorFactory implements ConstraintValidatorFactory, Closeable {
-    private final Collection<BValExtension.Releasable<?>> releasables = new CopyOnWriteArrayList<BValExtension.Releasable<?>>();
+    private final Collection<BValExtension.Releasable<?>> releasables =
+        new CopyOnWriteArrayList<BValExtension.Releasable<?>>();
     private volatile Boolean useCdi = null; // store it to avoid NoClassDefFoundError when cdi is not present (it is slow) + lazily (to wait cdi is started)
 
     /**

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultMessageInterpolator.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultMessageInterpolator.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultMessageInterpolator.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultMessageInterpolator.java Tue Oct 25 15:34:35 2016
@@ -54,8 +54,7 @@ public class DefaultMessageInterpolator
     private Locale defaultLocale;
 
     /** User specified resource bundles hashed against their locale. */
-    private final Map<Locale, ResourceBundle> userBundlesMap =
-          new ConcurrentHashMap<Locale, ResourceBundle>();
+    private final Map<Locale, ResourceBundle> userBundlesMap = new ConcurrentHashMap<Locale, ResourceBundle>();
 
     /** Builtin resource bundles hashed against their locale. */
     private final Map<Locale, ResourceBundle> defaultBundlesMap = new ConcurrentHashMap<Locale, ResourceBundle>();
@@ -86,7 +85,8 @@ public class DefaultMessageInterpolator
 
         MessageEvaluator ev = null;
         try {
-            ev = MessageEvaluator.class.cast(getClass().getClassLoader().loadClass("org.apache.bval.el.ELFacade").newInstance());
+            ev = MessageEvaluator.class
+                .cast(getClass().getClassLoader().loadClass("org.apache.bval.el.ELFacade").newInstance());
         } catch (final Throwable e) { // can be exception or error
             // no-op
         }
@@ -104,8 +104,8 @@ public class DefaultMessageInterpolator
     /** {@inheritDoc} */
     @Override
     public String interpolate(String message, Context context, Locale locale) {
-        return interpolateMessage(message,
-                context.getConstraintDescriptor().getAttributes(), locale, context.getValidatedValue());
+        return interpolateMessage(message, context.getConstraintDescriptor().getAttributes(), locale,
+            context.getValidatedValue());
     }
 
     /**
@@ -120,9 +120,8 @@ public class DefaultMessageInterpolator
      * @param locale               the <code>Locale</code> to use for the resource bundle.
      * @return the interpolated message.
      */
-    private String interpolateMessage(String message,
-                                      Map<String, Object> annotationParameters,
-                                      Locale locale, Object validatedValue) {
+    private String interpolateMessage(String message, Map<String, Object> annotationParameters, Locale locale,
+        Object validatedValue) {
         ResourceBundle userResourceBundle = findUserResourceBundle(locale);
         ResourceBundle defaultResourceBundle = findDefaultResourceBundle(locale);
 
@@ -131,19 +130,16 @@ public class DefaultMessageInterpolator
         boolean evaluatedDefaultBundleOnce = false;
         do {
             // search the user bundle recursive (step1)
-            userBundleResolvedMessage =
-                  replaceVariables(resolvedMessage, userResourceBundle, locale, true);
+            userBundleResolvedMessage = replaceVariables(resolvedMessage, userResourceBundle, locale, true);
 
             // exit condition - we have at least tried to validate against the default bundle and there were no
             // further replacements
-            if (evaluatedDefaultBundleOnce &&
-                  !hasReplacementTakenPlace(userBundleResolvedMessage, resolvedMessage)) {
+            if (evaluatedDefaultBundleOnce && !hasReplacementTakenPlace(userBundleResolvedMessage, resolvedMessage)) {
                 break;
             }
 
             // search the default bundle non recursive (step2)
-            resolvedMessage = replaceVariables(userBundleResolvedMessage,
-                  defaultResourceBundle, locale, false);
+            resolvedMessage = replaceVariables(userBundleResolvedMessage, defaultResourceBundle, locale, false);
 
             evaluatedDefaultBundleOnce = true;
         } while (true);
@@ -157,7 +153,8 @@ public class DefaultMessageInterpolator
         }
 
         // curly braces need to be scaped in the original msg, so unescape them now
-        resolvedMessage = resolvedMessage.replace( "\\{", "{" ).replace( "\\}", "}" ).replace( "\\\\", "\\" ).replace( "\\$", "$" );
+        resolvedMessage =
+            resolvedMessage.replace("\\{", "{").replace("\\}", "}").replace("\\\\", "\\").replace("\\$", "$");
 
         return resolvedMessage;
     }
@@ -176,27 +173,27 @@ public class DefaultMessageInterpolator
         ResourceBundle rb = null;
         final ClassLoader classLoader = Reflection.getClassLoader(DefaultMessageInterpolator.class);
         if (classLoader != null) {
-            rb = loadBundle(classLoader, locale,
-                  USER_VALIDATION_MESSAGES + " not found by thread local classloader");
+            rb = loadBundle(classLoader, locale, USER_VALIDATION_MESSAGES + " not found by thread local classloader");
         }
 
         // 2011-03-27 jw: No privileged action required.
         // A class can always access the classloader of itself and of subclasses.
         if (rb == null) {
-            rb = loadBundle(getClass().getClassLoader(), locale, USER_VALIDATION_MESSAGES + " not found by validator classloader");
+            rb = loadBundle(getClass().getClassLoader(), locale,
+                USER_VALIDATION_MESSAGES + " not found by validator classloader");
         }
         if (LOG_FINEST) {
             if (rb != null) {
                 log.log(Level.FINEST, String.format("%s found", USER_VALIDATION_MESSAGES));
             } else {
-                log.log(Level.FINEST, String.format("%s not found. Delegating to %s", USER_VALIDATION_MESSAGES, DEFAULT_VALIDATION_MESSAGES));
+                log.log(Level.FINEST, String.format("%s not found. Delegating to %s", USER_VALIDATION_MESSAGES,
+                    DEFAULT_VALIDATION_MESSAGES));
             }
         }
         return rb;
     }
 
-    private ResourceBundle loadBundle(ClassLoader classLoader, Locale locale,
-                                      String message) {
+    private ResourceBundle loadBundle(ClassLoader classLoader, Locale locale, String message) {
         ResourceBundle rb = null;
         try {
             rb = ResourceBundle.getBundle(USER_VALIDATION_MESSAGES, locale, classLoader);
@@ -206,8 +203,7 @@ public class DefaultMessageInterpolator
         return rb;
     }
 
-    private String replaceVariables(String message, ResourceBundle bundle, Locale locale,
-                                    boolean recurse) {
+    private String replaceVariables(String message, ResourceBundle bundle, Locale locale, boolean recurse) {
         final Matcher matcher = messageParameterPattern.matcher(message);
         final StringBuffer sb = new StringBuffer(64);
         String resolvedParameterValue;
@@ -221,8 +217,7 @@ public class DefaultMessageInterpolator
         return sb.toString();
     }
 
-    private String replaceAnnotationAttributes(final String message,
-                                               final Map<String, Object> annotationParameters) {
+    private String replaceAnnotationAttributes(final String message, final Map<String, Object> annotationParameters) {
         Matcher matcher = messageParameterPattern.matcher(message);
         StringBuffer sb = new StringBuffer(64);
         while (matcher.find()) {
@@ -244,8 +239,7 @@ public class DefaultMessageInterpolator
         return sb.toString();
     }
 
-    private String resolveParameter(String parameterName, ResourceBundle bundle,
-                                    Locale locale, boolean recurse) {
+    private String resolveParameter(String parameterName, ResourceBundle bundle, Locale locale, boolean recurse) {
         String parameterValue;
         try {
             if (bundle != null) {
@@ -270,8 +264,7 @@ public class DefaultMessageInterpolator
 
     private ResourceBundle findDefaultResourceBundle(Locale locale) {
         ResourceBundle bundle = defaultBundlesMap.get(locale);
-        if (bundle == null)
-        {
+        if (bundle == null) {
             bundle = ResourceBundle.getBundle(DEFAULT_VALIDATION_MESSAGES, locale);
             defaultBundlesMap.put(locale, bundle);
         }
@@ -280,8 +273,7 @@ public class DefaultMessageInterpolator
 
     private ResourceBundle findUserResourceBundle(Locale locale) {
         ResourceBundle bundle = userBundlesMap.get(locale);
-        if (bundle == null)
-        {
+        if (bundle == null) {
             bundle = getFileBasedResourceBundle(locale);
             if (bundle != null) {
                 userBundlesMap.put(locale, bundle);

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultValidationProviderResolver.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultValidationProviderResolver.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultValidationProviderResolver.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultValidationProviderResolver.java Tue Oct 25 15:34:35 2016
@@ -16,7 +16,6 @@
  */
 package org.apache.bval.jsr;
 
-
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -37,8 +36,7 @@ import org.apache.commons.weaver.privili
 public class DefaultValidationProviderResolver implements ValidationProviderResolver {
 
     //TODO - Spec recommends caching per classloader
-    private static final String SPI_CFG =
-        "META-INF/services/javax.validation.spi.ValidationProvider";
+    private static final String SPI_CFG = "META-INF/services/javax.validation.spi.ValidationProvider";
 
     /**
      * {@inheritDoc}
@@ -69,11 +67,12 @@ public class DefaultValidationProviderRe
                                 final Class<? extends ValidationProvider> providerType =
                                     cl.loadClass(line).asSubclass(ValidationProvider.class);
                                 // create an instance to return
-                                providers.add(Reflection.newInstance(providerType.asSubclass(ValidationProvider.class)));
+                                providers
+                                    .add(Reflection.newInstance(providerType.asSubclass(ValidationProvider.class)));
 
                             } catch (ClassNotFoundException e) {
-                                throw new ValidationException("Failed to load provider " +
-                                    line + " configured in file " + url, e);
+                                throw new ValidationException(
+                                    "Failed to load provider " + line + " configured in file " + url, e);
                             }
                         }
                         line = br.readLine();

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ElementDescriptorImpl.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ElementDescriptorImpl.java?rev=1766546&r1=1766545&r2=1766546&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ElementDescriptorImpl.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/ElementDescriptorImpl.java Tue Oct 25 15:34:35 2016
@@ -36,7 +36,8 @@ import java.util.concurrent.CopyOnWriteA
  * Description: MetaData class<br/>
  */
 public abstract class ElementDescriptorImpl implements ElementDescriptor {
-    private final Set<GroupConversionDescriptor> groupConversions = new CopyOnWriteArraySet<GroupConversionDescriptor>();
+    private final Set<GroupConversionDescriptor> groupConversions =
+        new CopyOnWriteArraySet<GroupConversionDescriptor>();
     private boolean cascaded;
     private final Collection<Object> validated = new CopyOnWriteArraySet<Object>();
 
@@ -104,7 +105,7 @@ public abstract class ElementDescriptorI
      * {@inheritDoc}
      */
     @Override
-    @SuppressWarnings({"unchecked", "rawtypes"})
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public ElementDescriptor.ConstraintFinder findConstraints() {
         return new ConstraintFinderImpl(metaBean, new HashSet(constraintDescriptors));
     }
@@ -114,8 +115,8 @@ public abstract class ElementDescriptorI
      */
     @Override
     public Set<ConstraintDescriptor<?>> getConstraintDescriptors() {
-        return constraintDescriptors.isEmpty() ? Collections.<ConstraintDescriptor<?>> emptySet() : Collections
-            .unmodifiableSet(constraintDescriptors);
+        return constraintDescriptors.isEmpty() ? Collections.<ConstraintDescriptor<?>> emptySet()
+            : Collections.unmodifiableSet(constraintDescriptors);
     }
 
     /**




Mime
View raw message