struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronny Løvtangen (JIRA) <j...@apache.org>
Subject [jira] Issue Comment Edited: (WW-2869) Actions invoked with <s:action..> gets actionErrors copied from main action
Date Thu, 15 Apr 2010 19:16:54 GMT

    [ https://issues.apache.org/jira/browse/WW-2869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857496#action_12857496
] 

Ronny Løvtangen edited comment on WW-2869 at 4/15/10 3:16 PM:
--------------------------------------------------------------

I found a workaround for the maven problems by commenting out the reference to xwork-core
javadoc from assembly/pom.xml. (should probably be fixed)

I have now tried the patch.
The line

        boolean isChainResult = ActionChainResult.class.isAssignableFrom(invocation.getResult().getClass());

in ChainingInterceptor produces NPE for FooAction (would also do the same for BarAction if
it came that far) because invocation.getResult() yields null.
But for chain result this would probably not be the case?
I tweeked the code to

        boolean isChainResult = invocation.getResult() != null && ActionChainResult.class.isAssignableFrom(invocation.getResult().getClass());

then my attached example project (test.zip) works!
But I don't know if normal chaining then works, as I don't use, and are not into that feature.
If it does, then we seem to have a fix :)




      was (Author: ronnylovtangen):
    I found a workaround for the maven problems by commenting out the reference to xwork-core
javadoc from assembly/pom.xml. (should probably be fixed)

I have now tried the patch.
The line
{code}
        boolean isChainResult = ActionChainResult.class.isAssignableFrom(invocation.getResult().getClass());
{code}
in ChainingInterceptor produces NPE for FooAction (would also do the same for BarAction if
it came that far) because invocation.getResult() yields null.
But for chain result this would probably not be the case?
I tweeked the code to
{code}
        boolean isChainResult = invocation.getResult() != null && ActionChainResult.class.isAssignableFrom(invocation.getResult().getClass());
{code}
then my attached example project (test.zip) works!
But I don't know if normal chaining then works, as I don't use, and are not into that feature.
If it does, then we seem to have a fix :)



  
> Actions invoked with <s:action..> gets actionErrors copied from main action
> ---------------------------------------------------------------------------
>
>                 Key: WW-2869
>                 URL: https://issues.apache.org/jira/browse/WW-2869
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.13, 2.1.2
>            Reporter: Ronny Løvtangen
>            Assignee: Lukasz Lenart
>         Attachments: test.zip, WW-2869.patch
>
>
> If I invoke an action from a JSP with <s:action..>, that action will get actionErrors
copied from the first action.
> This is done by ChainingInterceptor, unless the first action implements Unchainable.
> Actions included with <s:action..> should be independent of the page they are included
from, this is not the same as using resultType 'chain'.
> Example:
> FooAction:
> public class FooAction extends ActionSupport {
>   public String execute() {
>         addActionError("an error from FooAction");
>         return SUCCESS;
>   }
> }
> foo.jsp:
> <s:action name="bar"/>
> BarAction:
> public class BarAction extends ActionSupport{    
> }
> struts.xml:
> <action name="foo" class="test.FooAction">
> 	<result>/jsp/foo.jsp</result>
> </action>
> <action name="bar" class="test.BarAction">
> 	<result>/jsp/bar.jsp</result>
> </action>
> When going to /foo.action then BarAction is never invoked because:
> 1) FooAction adds actionError
> 2) foo.jsp is displayed
> 3) foo.jsp invokes BarAction with <s:action..> tag
> 4) ChainingInterceptor intercepts BarAction and copies actionErrors from FooAction to
BarAction
> 5) DefaultWorkflowInterceptor intercepts BarAction and since BarAction now has actionErrors,
it stops the invocation and returns "input"
> 6) There is no "input" result defined for BarAction, which leads to Exception
> This is the line in ChainingInterceptor that copies the actionErrors:
> reflectionProvider.copy(o, invocation.getAction(), ctxMap, excludes, includes);
> This shouldn't be done in the case of a <s:action..>, only for resultType 'chain'
> I have verified that this is still an issue in the latest svn version of 2.1.3 (rev 701674).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message