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

Lukasz Lenart closed WW-3066.
-----------------------------
    Resolution: Fixed

> RegexFieldValidator not working correctly on IBM JVM - xml validation files
> ---------------------------------------------------------------------------
>
>                 Key: WW-3066
>                 URL: https://issues.apache.org/jira/browse/WW-3066
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.1.6
>         Environment: IBM WAS 7.0
>            Reporter: Tomasz Filak
>            Priority: Major
>             Fix For: 6.1.0
>
>
> We use -validation.xml files in our struts2 web application. Validation 
> worked fine on Tomcat but since we migrated to Websphere 7.0, we have noticed 
> strange behaviour of the XWork Validator framework. After some debugging we 
> found, that the reason was RegexFieldValidator.getTextValue(Element valueEle) 
> method.
> On IBM JVM, XML expressions containing XML entities (such as & or > ) 
> are parsed as separate nodes, so following configuration:
> <field-validator type="fieldexpression">
>       <param name="expression">( (placeId != null &amp;&amp; placeId &gt; 
> 0))</param>
>       <message>String required</message>
> </field-validator>
> resulted in following Nodes being bassed to 
> RegexFieldValidator.getTextValue() method:
> ( (placeId != null 
> &
> &
>  placeId 
> >
>  0))
> After merging those nodes, getTextValue returned this String: "( (placeId != 
> null & & placeId >  0))."
> Additional space were added added between nodes, which broke the whole 
> expression. The same behaviour was noticed when using CDATA tag.
> Our quick-fix was to override the RegexFieldValidator.getTextValue() to 
> delegate to DomUtils.getTextValue() method.
> Best regards.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to