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:
<param name="expression">( (placeId != null && placeId > 0))</param>
resulted in following Nodes being bassed to RegexFieldValidator.getTextValue() method:
( (placeId != null
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.