You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Haroon Rafique (JIRA)" <ji...@apache.org> on 2010/03/11 18:35:27 UTC

[jira] Commented: (WW-3346) ValidatorSupport turns empty defaultMessage to null causing field error to include "null" for visitor validators with empty messages

    [ https://issues.apache.org/jira/browse/WW-3346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844146#action_12844146 ] 

Haroon Rafique commented on WW-3346:
------------------------------------

Please be advised that this issue can be closed, now that XW-737 is fixed.

> ValidatorSupport turns empty defaultMessage to null causing field error to include "null" for visitor validators with empty messages
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3346
>                 URL: https://issues.apache.org/jira/browse/WW-3346
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.2.0
>         Environment: struts 2.1.8, xwork 2.1.6, jdk 1.6 
>            Reporter: Haroon Rafique
>            Assignee: musachy
>         Attachments: XW-737-null-defaultMessage.patch
>
>
> I reported this as http://jira.opensymphony.com/browse/XW-737 and I was asked to report this here as well.
> Upon upgrading to struts 2.1.8 (from 2.0.14) with xwork 2.1.6, I started getting field errors which included the string null in them for field visitor validators.
> Using a visitor validator as follows:
>     <field name="residenceRoom">
>         <field-validator type="visitor">
>             <message/>
>         </field-validator>
>     </field>
> and a required string validator on the actual field as follows:
>     <field name="description">
>         <field-validator type="requiredstring">
>             <message>Description is required</message>
>         </field-validator>
>     </field> 
> I was expecting the field for residenceRoom.description to contain "Description is required" but instead it contained "nullDescription is required". Presumably this happens because of line 202 in VisitorFieldValidator.java
> super.addFieldError(getFullFieldName(fieldName), message + errorMessage);
> The fix for me seems to be to fix ValidatorSupport to not nullify defaultMessage when message is null or empty. I will attach a patch shortly.

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