You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Kjell Martin Rud (JIRA)" <ji...@apache.org> on 2007/11/19 16:09:33 UTC

[jira] Created: (WW-2331) Incorrect property path appending in AppendingValidatorContext.

Incorrect property path appending in AppendingValidatorContext.
---------------------------------------------------------------

                 Key: WW-2331
                 URL: https://issues.apache.org/struts/browse/WW-2331
             Project: Struts 2
          Issue Type: Bug
          Components: XML Validators
            Reporter: Kjell Martin Rud


Bug priorly reported and "fixed" in issue WW-2112. Fix will only work with AppendingValidatorContext. It does not fix the property path of added errors. Read issue WW-2112 before continuing on this issue. The text below is also added as a comment to WW-2112. So is a link to this issue.

First of all, it does not have to be only AppendingValidatorContext that recursivly appends field names. getFullFieldName(..) is defined in ValidatorContext interface and should therefor be used by AppendingValidatorContext regardless of the implementing class. This would result in AppendingValidatorContext having the following implementation of getFullFieldName(...): 

public String getFullFieldName(String fieldName) { 
    return parent.getFullFieldName(field + "." + fieldName); 
} 

provided, as with the prior solution proposal, that "parent" is an instance variable of AppendingValidatorContext. 

But, AppendingValidatorContext also converts any action errors added to field errors giving the full parent field name. This field name was not changed in the prior solution and will therefor give a wrong property path for the field error. A possible solution is to change the implementation of addActionError(...) to the following: 

public void addActionError(String anErrorMessage) { 
    super.addFieldError(parent.getFullFieldName(field), message + anErrorMessage); 
}

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


[jira] Resolved: (WW-2331) Incorrect property path appending in AppendingValidatorContext.

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown resolved WW-2331.
---------------------------

    Resolution: Fixed
      Assignee: Don Brown

Fixed, thanks.

> Incorrect property path appending in AppendingValidatorContext.
> ---------------------------------------------------------------
>
>                 Key: WW-2331
>                 URL: https://issues.apache.org/struts/browse/WW-2331
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>            Reporter: Kjell Martin Rud
>            Assignee: Don Brown
>             Fix For: 2.1.1
>
>
> Bug priorly reported and "fixed" in issue WW-2112. Fix will only work with AppendingValidatorContext. It does not fix the property path of added errors. Read issue WW-2112 before continuing on this issue. The text below is also added as a comment to WW-2112. So is a link to this issue.
> First of all, it does not have to be only AppendingValidatorContext that recursivly appends field names. getFullFieldName(..) is defined in ValidatorContext interface and should therefor be used by AppendingValidatorContext regardless of the implementing class. This would result in AppendingValidatorContext having the following implementation of getFullFieldName(...): 
> public String getFullFieldName(String fieldName) { 
>     return parent.getFullFieldName(field + "." + fieldName); 
> } 
> provided, as with the prior solution proposal, that "parent" is an instance variable of AppendingValidatorContext. 
> But, AppendingValidatorContext also converts any action errors added to field errors giving the full parent field name. This field name was not changed in the prior solution and will therefor give a wrong property path for the field error. A possible solution is to change the implementation of addActionError(...) to the following: 
> public void addActionError(String anErrorMessage) { 
>     super.addFieldError(parent.getFullFieldName(field), message + anErrorMessage); 
> }

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