RegexFieldValidator not working correctly on IBM JVM - xml validation files
---------------------------------------------------------------------------

                 Key: WW-3066
                 URL: https://issues.apache.org/struts/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


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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to