struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [16/17] struts git commit: Injects missing dependency
Date Mon, 13 Mar 2017 17:46:25 GMT
Injects missing dependency


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

Branch: refs/heads/master
Commit: 6d60064bea0481b684bf284ebea285c33684ca3b
Parents: ce2261f
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Mon Mar 13 06:51:47 2017 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Mon Mar 13 06:51:47 2017 +0100

----------------------------------------------------------------------
 .../validation/interceptor/BeanValidationInterceptor.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/6d60064b/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
----------------------------------------------------------------------
diff --git a/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
b/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
index 3cd56e9..3123a4b 100644
--- a/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
+++ b/plugins/bean-validation/src/main/java/org/apache/struts/beanvalidation/validation/interceptor/BeanValidationInterceptor.java
@@ -23,6 +23,7 @@ package org.apache.struts.beanvalidation.validation.interceptor;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ActionProxy;
 import com.opensymphony.xwork2.ModelDriven;
+import com.opensymphony.xwork2.TextProviderFactory;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
 import com.opensymphony.xwork2.util.AnnotationUtils;
@@ -55,7 +56,9 @@ import java.util.Set;
 public class BeanValidationInterceptor extends MethodFilterInterceptor {
 
     private static final Logger LOG = LogManager.getLogger(BeanValidationInterceptor.class);
+
     protected BeanValidationManager beanValidationManager;
+    protected TextProviderFactory textProviderFactory;
     protected boolean convertToUtf8 = false;
     protected String convertFromEncoding = "ISO-8859-1";
 
@@ -64,6 +67,11 @@ public class BeanValidationInterceptor extends MethodFilterInterceptor
{
         this.beanValidationManager = beanValidationManager;
     }
 
+    @Inject
+    public void setTextProviderFactory(TextProviderFactory textProviderFactory) {
+        this.textProviderFactory = textProviderFactory;
+    }
+
     @Inject(value = ValidatorConstants.CONVERT_MESSAGE_TO_UTF8, required = false)
     public void setConvertToUtf8(String convertToUtf8) {
         this.convertToUtf8 = BooleanUtils.toBoolean(convertToUtf8);
@@ -122,7 +130,7 @@ public class BeanValidationInterceptor extends MethodFilterInterceptor
{
     @SuppressWarnings("nls")
     private void addBeanValidationErrors(Set<ConstraintViolation<Object>> constraintViolations,
Object action) {
         if (constraintViolations != null) {
-            ValidatorContext validatorContext = new DelegatingValidatorContext(action);
+            ValidatorContext validatorContext = new DelegatingValidatorContext(action, textProviderFactory);
             for (ConstraintViolation<Object> constraintViolation : constraintViolations)
{
                 String key = constraintViolation.getMessage();
                 String message = key;


Mime
View raw message