Is there any workaround for OGNL3.0.21 property binding issue for properties like fName (Struts2 Issue-WW-4616)?

235 Views Asked by At

Recently we were supposed to upgrade from struts-2.3.20 to struts-2.3.37 due to security vulnerabilities. So we upgraded from ognl-3.0.6 to ognl-3.0.21, which has an issue WW-4616. Due to this many of our application properties are not getting set by params interceptor. Properties like fName,sModuleName are not getting set in action classes. I checked jira links but was not able find a solution or workaround for the same. A Below is the sample code that does not work

private String sModuleName;

public String getSModuleName() {
        return sModuleName;
}

public void setSModuleName(final String moduleName) {
        sModuleName = moduleName;
} 

I found following solutions:

  1. Changing the variable name or getter and setter, which is very big change for our application.
  2. reverting back to ognl-3.0.6 with struts-2.3.37, this does not work it gives me following error

    <Feb 13, 2019 2:27:56 PM EST> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.
    java.lang.NoSuchMethodError: ognl.SimpleNode.isSequence(Lognl/OgnlContext;)Z
        at com.opensymphony.xwork2.ognl.OgnlUtil.isEvalExpression(OgnlUtil.java:356)
        at com.opensymphony.xwork2.ognl.OgnlUtil.checkEnableEvalExpression(OgnlUtil.java:467)
        at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecute(OgnlUtil.java:422)
        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:334)
        at com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:663)
        Truncated. see log file for complete stacktrace
    

It is very big change in our application to modify such properties name or getter and setter. So I am looking for a workaround.

0

There are 0 best solutions below