[ 
https://issues.apache.org/struts/browse/WW-3109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wes Wannemacher resolved WW-3109.
---------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.1.8)
                   2.1.7
         Assignee: Musachy Barroso

Musachy fixed this in XWork back in March... Unfortunately, Fisheye on 
opensymphony is out of sync, but here is the patch from the fix - 

Index: 
src/java/com/opensymphony/xwork2/validator/validators/ValidatorSupport.java
===================================================================
--- src/java/com/opensymphony/xwork2/validator/validators/ValidatorSupport.java 
(revision 1956)
+++ src/java/com/opensymphony/xwork2/validator/validators/ValidatorSupport.java 
(revision 1957)
@@ -13,7 +13,9 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.lang.StringUtils;
 
+
 /**
  * Abstract implementation of the Validator interface suitable for subclassing.
  *
@@ -96,7 +98,8 @@
             message = defaultMessage;
         }
 
-        message = TextParseUtil.translateVariables(message, stack);
+        if (StringUtils.isNotBlank(message))
+            message = TextParseUtil.translateVariables(message, stack);
 
         stack.pop();


You can try to create a patched copy of xwork, or wait on the next release of 
Struts, which should be pretty soon.

> Visitor validator crashes when <message> is blank
> -------------------------------------------------
>
>                 Key: WW-3109
>                 URL: https://issues.apache.org/struts/browse/WW-3109
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.1.6
>         Environment: Struts 2.1.6 on Websphere 6.1
>            Reporter: Jon
>            Assignee: Musachy Barroso
>             Fix For: 2.1.7
>
>
> Using a visitor validator crashes application if the <message> element is 
> empty. e.g.
> In BeanName-validation.xml this will crash.
>       <field name="lifeAssured">
>               <field-validator type="visitor">
>                       <param name="appendPrefix">true</param>
>                       <message></message>
>               </field-validator>
>       </field>
> But this will work fine.
>       <field name="lifeAssured">
>               <field-validator type="visitor">
>                       <param name="appendPrefix">true</param>
>                       <message>Hi</message>
>               </field-validator>
>       </field>
> Message shouldn't be mandatory - I'm happy for the messages defined in the 
> nested beans validator to be displayed against the field without anything 
> prepended.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to