struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cnenn...@apache.org
Subject [06/10] struts git commit: using ObjectFactory instead of Class.forName()
Date Fri, 12 Jun 2015 08:53:36 GMT
using ObjectFactory instead of Class.forName()

Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/372ce960
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/372ce960
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/372ce960

Branch: refs/heads/master
Commit: 372ce960e2395cdbe89c16e142e4a4f2214f7fa1
Parents: 8128ca6
Author: cnenning <cnenning@apache.org>
Authored: Fri Jun 12 10:30:38 2015 +0200
Committer: cnenning <cnenning@apache.org>
Committed: Fri Jun 12 10:30:38 2015 +0200

----------------------------------------------------------------------
 .../validation/interceptor/DefaultBeanValidationManager.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/372ce960/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/DefaultBeanValidationManager.java
----------------------------------------------------------------------
diff --git a/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/DefaultBeanValidationManager.java
b/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/DefaultBeanValidationManager.java
index b502c33..c54cca8 100644
--- a/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/DefaultBeanValidationManager.java
+++ b/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/DefaultBeanValidationManager.java
@@ -20,7 +20,9 @@
  */
 package org.apache.struts.beanvalidation.validation.interceptor;
 
+import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.inject.Inject;
+
 import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
@@ -62,14 +64,14 @@ public class DefaultBeanValidationManager
     @Inject
     public DefaultBeanValidationManager(
                 @Inject(value = ValidatorConstants.PROVIDER_CLASS, required = false) String
providerClassName,
-                @Inject(value = ValidatorConstants.IGNORE_XMLCONFIGURAITION, required = false)String
ignoreXMLConfiguration) {
+                @Inject(value = ValidatorConstants.IGNORE_XMLCONFIGURAITION, required = false)String
ignoreXMLConfiguration,
+                @Inject(required = true) ObjectFactory objectFactory) {
         super();
         LOG.info("Initializing bean validation factory to get a validator");
 
         if (StringUtils.isNotBlank(providerClassName)) {
             try {
-                this.providerClass =
-                    (Class<? extends ValidationProvider<? extends Configuration<?>>>)
Class.forName(providerClassName);
+            	this.providerClass = objectFactory.getClassInstance(providerClassName);
                 LOG.info(this.providerClass.getName() + " validator found");
             } catch (ClassNotFoundException e) {
                 LOG.error("Unable to find any bean validator implementation for " + providerClassName);


Mime
View raw message