bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1762805 - /bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationParser.java
Date Thu, 29 Sep 2016 16:16:23 GMT
Author: mbenson
Date: Thu Sep 29 16:16:23 2016
New Revision: 1762805

URL: http://svn.apache.org/viewvc?rev=1762805&view=rev
Log:
automated cleanups and a ws change

Modified:
    bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationParser.java

Modified: bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationParser.java
URL: http://svn.apache.org/viewvc/bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationParser.java?rev=1762805&r1=1762804&r2=1762805&view=diff
==============================================================================
--- bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationParser.java (original)
+++ bval/trunk/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationParser.java Thu Sep
29 16:16:23 2016
@@ -133,7 +133,6 @@ public class ValidationParser {
                     parser.xmlConfig.getExecutableValidation().getEnabled(),
                     new CopyOnWriteArraySet<ExecutableType>(targetConfig.getExecutableValidation()),
                     toMap(parser.xmlConfig.getProperty()));
-            return parser;
         } else { // default config
             final CopyOnWriteArraySet<ExecutableType> executableTypes = new CopyOnWriteArraySet<ExecutableType>();
             executableTypes.add(ExecutableType.CONSTRUCTORS);
@@ -148,7 +147,6 @@ public class ValidationParser {
 
             targetConfig.setExecutableValidation(executableTypes);
         }
-
         return parser;
     }
 
@@ -272,12 +270,12 @@ public class ValidationParser {
         if (targetConfig.getParameterNameProvider() == targetConfig.getDefaultParameterNameProvider())
{ // ref ==
             if (parameterNameProvider != null) {
                 final Class<?> loaded = loadClass(parameterNameProvider);
-                if (loaded != null) {
+                if (loaded == null) {
+                    log.log(Level.SEVERE, "Can't load " + parameterNameProvider);
+                } else {
                     final Class<? extends ParameterNameProvider> clazz = loaded.asSubclass(ParameterNameProvider.class);
                     targetConfig.parameterNameProviderClass(clazz);
                     log.log(Level.INFO, String.format("Using %s as validation provider.",
parameterNameProvider));
-                } else {
-                    log.log(Level.SEVERE, "Can't load " + parameterNameProvider);
                 }
             }
         }
@@ -312,28 +310,24 @@ public class ValidationParser {
     private void applyTraversableResolver(ValidationConfigType xmlConfig,
                                           ConfigurationImpl target) {
         String traversableResolverClass = xmlConfig.getTraversableResolver();
-        if (target.getTraversableResolver() == target.getDefaultTraversableResolver()) {
// ref ==
-            if (traversableResolverClass != null) {
-                Class<TraversableResolver> clazz = (Class<TraversableResolver>)
-                        loadClass(traversableResolverClass);
-                target.traversableResolverClass(clazz);
-                log.log(Level.INFO, String.format("Using %s as traversable resolver.", traversableResolverClass));
-            }
-        }
+        if (target.getTraversableResolver() == target.getDefaultTraversableResolver() &&
traversableResolverClass != null) {
+		    Class<TraversableResolver> clazz = (Class<TraversableResolver>)
+		            loadClass(traversableResolverClass);
+		    target.traversableResolverClass(clazz);
+		    log.log(Level.INFO, String.format("Using %s as traversable resolver.", traversableResolverClass));
+		}
     }
 
     @SuppressWarnings("unchecked")
     private void applyConstraintFactory(ValidationConfigType xmlConfig,
                                         ConfigurationImpl target) {
         String constraintFactoryClass = xmlConfig.getConstraintValidatorFactory();
-        if (target.getConstraintValidatorFactory() == target.getDefaultConstraintValidatorFactory())
{ // ref ==
-            if (constraintFactoryClass != null) {
-                Class<ConstraintValidatorFactory> clazz = (Class<ConstraintValidatorFactory>)
-                        loadClass(constraintFactoryClass);
-                target.constraintValidatorFactoryClass(clazz);
-                log.log(Level.INFO, String.format("Using %s as constraint factory.", constraintFactoryClass));
-            }
-        }
+        if (target.getConstraintValidatorFactory() == target.getDefaultConstraintValidatorFactory()
&& constraintFactoryClass != null) {
+		    Class<ConstraintValidatorFactory> clazz = (Class<ConstraintValidatorFactory>)
+		            loadClass(constraintFactoryClass);
+		    target.constraintValidatorFactoryClass(clazz);
+		    log.log(Level.INFO, String.format("Using %s as constraint factory.", constraintFactoryClass));
+		}
     }
 
     private static void applyMappingStreams(ValidationConfigType xmlConfig,
@@ -375,7 +369,7 @@ public class ValidationParser {
 
     public void ensureValidatorFactoryCanBeBuilt() {
         if (!exceptions.isEmpty()) {
-            throw  exceptions.iterator().next();
+            throw exceptions.iterator().next();
         }
     }
 }



Mime
View raw message