A concrete example would be: if there are interceptors implemented before the 
actions get called, the interceptors push information holders into the stack, 
and whatever the interceptors push to the stack will be first pulled off by the 
peek process in the statement "rootObject = invocation.getStack().peek();". 
This is an example scenario where the action object will not be pulled off by 
the peek process, instead whatever pushed into the stack by the interceptors 
will be returned since interceptors get called before the actions.

Thanks.
Jerry


-----Original Message-----
From: Jason Pyeron [mailto:jpye...@pdinc.us] 
Sent: Wednesday, May 18, 2011 1:54 PM
To: 'Struts Developers List'
Subject: RE: Issue Reporting: problem with findRootObject process in 
struts2-json-plugin-2.2.3.jar

> -----Original Message-----
> From: Jerry Yuan [mailto:jy...@trionworlds.com]
> Sent: Wednesday, May 18, 2011 16:40
> To: 'dev@struts.apache.org'
> Subject: Issue Reporting: problem with findRootObject process in 
> struts2-json-plugin-2.2.3.jar
> 
> 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.

Could you send an example which fails due to the change?

> 
>     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
> 
> 
> 



--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org For additional 
commands, e-mail: dev-h...@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org

Reply via email to