You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Ronny Løvtangen (JIRA)" <ji...@apache.org> on 2008/11/14 23:23:44 UTC

[jira] Created: (WW-2869) Actions invoked with gets actionErrors copied from main action

Actions invoked with <s:action..> gets actionErrors copied from main action
---------------------------------------------------------------------------

                 Key: WW-2869
                 URL: https://issues.apache.org/struts/browse/WW-2869
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.1.2, 2.0.13
            Reporter: Ronny Løvtangen


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 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2869) Actions invoked with gets actionErrors copied from main action

Posted by "Ronny Løvtangen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2869?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ronny Løvtangen updated WW-2869:
--------------------------------

    Description: 
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).



  was:
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 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).




> Actions invoked with <s:action..> gets actionErrors copied from main action
> ---------------------------------------------------------------------------
>
>                 Key: WW-2869
>                 URL: https://issues.apache.org/struts/browse/WW-2869
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.13, 2.1.2
>            Reporter: Ronny Løvtangen
>         Attachments: test.zip
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2869) Actions invoked with gets actionErrors copied from main action

Posted by "Ronny Løvtangen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2869?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ronny Løvtangen updated WW-2869:
--------------------------------

    Component/s: Core Interceptors

> Actions invoked with <s:action..> gets actionErrors copied from main action
> ---------------------------------------------------------------------------
>
>                 Key: WW-2869
>                 URL: https://issues.apache.org/struts/browse/WW-2869
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.13, 2.1.2
>            Reporter: Ronny Løvtangen
>
> 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 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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2869) Actions invoked with gets actionErrors copied from main action

Posted by "Ronny Løvtangen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2869?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ronny Løvtangen updated WW-2869:
--------------------------------

    Attachment: test.zip

Added a maven 2 project which demonstrates the problem. Run with 'mvn jetty:run' and go to http://localhost:8080/test/foo.action to trigger the error.
Added an interceptor before and after 'chain' interceptor to demonstrate that this is the interceptor that does the actionError copying

> Actions invoked with <s:action..> gets actionErrors copied from main action
> ---------------------------------------------------------------------------
>
>                 Key: WW-2869
>                 URL: https://issues.apache.org/struts/browse/WW-2869
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.13, 2.1.2
>            Reporter: Ronny Løvtangen
>         Attachments: test.zip
>
>
> 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 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.
-
You can reply to this email to add a comment to the issue online.