We have just upgraded our applications from Struts 2.2.1 into Struts 2.2.3
(which was released on May 9, 2011). We saw and identified an issue in our
application after the upgrade, and the issue exists in the library
struts2-json-plugin-2.2.3.jar. Basically in the class
org.apache.struts2.json.JSONResult.java, the following method tries to find
rootObject, and when this.root is null, rootObject is set by the statement
"rootObject = invocation.getStack().peek();", but the previous versions 2.2.1.1
and 2.2.1 set it by using "rootObject = invocation.getAction();". Therefore, in
Struts 2.2.3 version, the first element is set to rootObject instead of action,
which in our case is a skin object, but we need to set action object to the
rootObject instead of first element by peek() process. Could you consider
modify this behavior to set it like the way Struts 2.2.1 does by using
"rootObject = invocation.getAction();"? If you need more information or test
data about it, please let me know.
private Object findRootObject(ActionInvocation invocation) {
Object rootObject;
if (this.root != null) {
ValueStack stack = invocation.getStack();
rootObject = stack.findValue(root);
} else {
rootObject = invocation.getStack().peek(); // model overrides action
}
return rootObject;
}
Thanks.
Jerry