You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "David Mansfield (JIRA)" <ji...@apache.org> on 2007/05/31 17:37:38 UTC

[jira] Created: (WW-1960) action tag violates ParameterAware contract

action tag violates ParameterAware contract
-------------------------------------------

                 Key: WW-1960
                 URL: https://issues.apache.org/struts/browse/WW-1960
             Project: Struts 2
          Issue Type: Bug
          Components: Actions
    Affects Versions: 2.0.6
         Environment: linux,jdk1.5,tomcat5.5
            Reporter: David Mansfield
            Priority: Minor


the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:

176:        if (parameters != null) {
177:            newParams.putAll(parameters);
178:        }

The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-1960) action tag violates ParameterAware contract

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

James Holmes updated WW-1960:
-----------------------------

    Affects Version/s: 2.0.10
        Fix Version/s:     (was: 2.0.10)
                       2.0.11

Moving to 2.0.11 in preparation for 2.0.10 release.

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Priority: Minor
>             Fix For: 2.0.11
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (WW-1960) action tag violates ParameterAware contract

Posted by "Claudio Pozzoli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46389#action_46389 ] 

Claudio Pozzoli edited comment on WW-1960 at 6/17/09 8:53 AM:
--------------------------------------------------------------

Doesn't this patch break some (legal?) usages of the "s:action" tag as well? We were used to pass actual objects to the action in order to create handy "widgets" used across the whole site, e.g.:


struts-widgets.xml:

<package name="widgets" namespace="/widgets" extends="struts-default">
    <default-interceptor-ref name="i18nStack" />
    ...
    <action name="dummyService" class="com.examples.widgets.ServicesAction" method="dummyService">
        <result>dummyServiceWidget.jsp</result>
    </action>
    ...
</package>


container.jsp:

<s:action namespace="/widgets" name="dummyService" executeResult="true">
    <s:param name="actualParam"     value="expensiveObject.beanList[index]" />
</s:action>


ServicesAction.java:

public class ServicesAction extends ActionSupport
{
    ... 
    // parameters
    private BeanType actualParam;

    public String dummyService() throws Exception
    {
        // use actualParam object...
    }

    public void setActualParam(BeanType actualParam)
    {
        this.actualParam = actualParam;
    }
    ...
}


This is a useful feature every time "s:action" gets repeatedly evaluated over a collection of parameters (getting back the object from a string identifier passed as parameter is not an option since it would be computationally expensive in our case).

Claudio

      was (Author: claudio.pozzoli):
    Doesn't this patch break some (legal?) usages of the "s:action" tag as well? We were used to pass actual objects to the action in order to create handy "widgets" used across the whole site, e.g.:


struts-widgets.xml:

<package name="widgets" namespace="/widgets" extends="struts-default">
    <default-interceptor-ref name="i18nStack" />
    ...
    <action name="dummyService" class="com.examples.widgets.ServicesAction" method="dummyService">
	<result>dummyServiceWidget.jsp</result>
    </action>
    ...
</package>


container.jsp:

<s:action namespace="/widgets" name="dummyService" executeResult="true">
    <s:param name="actualParam"     value="expensiveObject.beanList[index]" />
</s:action>


ServicesAction.java:

public class ServicesAction extends ActionSupport
{
    ... 
    // parameters
    private BeanType actualParam;

    public String dummyService() throws Exception
    {
        // use actualParam object...
    }

    public void setActualParam(BeanType actualParam)
    {
        this.actualParam = actualParam;
    }
    ...
}


This is a useful feature every time "s:action" gets repeatedly evaluated over a collection of parameters (getting back the object from a string identifier passed as parameter is not an option since it would be computationally expensive in our case).

Claudio
  
> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Assignee: Don Brown
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WW-1960) action tag violates ParameterAware contract

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

James Holmes reassigned WW-1960:
--------------------------------

    Assignee:     (was: James Holmes)

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Priority: Minor
>             Fix For: 2.0.10
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-1960) action tag violates ParameterAware contract

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

James Holmes updated WW-1960:
-----------------------------

    Affects Version/s: 2.0.7
                       2.0.8
                       2.0.9
        Fix Version/s:     (was: Future)
                       2.0.10

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Priority: Minor
>             Fix For: 2.0.10
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-1960) action tag violates ParameterAware contract

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

Ted Husted updated WW-1960:
---------------------------

    Fix Version/s: Future

Setting Fix Version to "future" for issues without a set fix version. 


> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Priority: Minor
>             Fix For: Future
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-1960) action tag violates ParameterAware contract

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

Don Brown resolved WW-1960.
---------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.0.12)
                   2.1.0
         Assignee: Don Brown

Fixed in 2.1 as it could break existing applications.  All values are now converted into string arrays, whether they want to be or not :)

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Assignee: Don Brown
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-1960) action tag violates ParameterAware contract

Posted by "David Mansfield (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41433 ] 

David Mansfield commented on WW-1960:
-------------------------------------

I had to work around the the problem with some pretty nasting o.getClass().isArray() and some casting.  this king of ugliness would need to be added to any action that uses the parameters map if it wants to be safe against future use of the s:action tag.  I could attempt a fix but I'm not sure what the workflow for doing that would be.



> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Priority: Minor
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-1960) action tag violates ParameterAware contract

Posted by "Martin Gainty (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45819#action_45819 ] 

Martin Gainty commented on WW-1960:
-----------------------------------

we can satisfy the upcast for 2nd parameter for Map.put to (upcast to Object) with
       List<String> var = new ArrayList<String>();

       String[] AlotOfString={"String1","String2"};
        for (String str : AlotOfStrings) 
       {
            val.add(str);
        }

   params.put(key,(Object)var);  //cast of List<String> to Object works..

//reference for HashMap put method available at
http://www.exciton.cs.rice.edu/javadocs/docs/api/java/util/HashMap.html
//  Object put(Object key, Object value)



> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Assignee: Don Brown
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-1960) action tag violates ParameterAware contract

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

James Holmes updated WW-1960:
-----------------------------

    Fix Version/s:     (was: 2.0.11)
                   2.0.12

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Priority: Minor
>             Fix For: 2.0.12
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WW-1960) action tag violates ParameterAware contract

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

James Holmes reassigned WW-1960:
--------------------------------

    Assignee: James Holmes

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Assignee: James Holmes
>            Priority: Minor
>             Fix For: Future
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (WW-1960) action tag violates ParameterAware contract

Posted by "Saqib Chaudhary (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45830#action_45830 ] 

Saqib Chaudhary edited comment on WW-1960 at 4/2/09 7:12 AM:
-------------------------------------------------------------

In case we are passing application objects to the action tag. This fix in ActionComponent breaks by converting our application object to a string (toString method). Making Ognl throw "no such method setMyObject([Ljava.lang.String;)" exception.

Works well for Integer for example because the toString method of Integer is the value of that Integer. Is this the desired result??

      was (Author: saqib):
    In case we are passing application objects to the action tag. This fix in ActionComponent breaks but converting our application object to a string (toString method). Works well for Integer for example because the toString method of Integer is the value of that Integer. 
  
> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Assignee: Don Brown
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-1960) action tag violates ParameterAware contract

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41434 ] 

James Holmes commented on WW-1960:
----------------------------------

The best way to provide a fix would be to make the changes to the Struts 2 source code on your machine and test them. Once you have the changes working, you can post the changes here to this ticket. Those changes can be in the form of a Unix diff/patch file or you can simply paste the changes here as a comment if it's a small change.

One of the committers can then commit the changes to the Struts 2 subversion source repository and they will make it into an upcoming release.



> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Priority: Minor
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-1960) action tag violates ParameterAware contract

Posted by "Saqib Chaudhary (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45830#action_45830 ] 

Saqib Chaudhary commented on WW-1960:
-------------------------------------

In case we are passing application objects to the action tag. This fix in ActionComponent breaks but converting our application object to a string (toString method). Works well for Integer for example because the toString method of Integer is the value of that Integer. 

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Assignee: Don Brown
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-1960) action tag violates ParameterAware contract

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41428 ] 

James Holmes commented on WW-1960:
----------------------------------

Is this something we need to fix?

David, is this causing problems for you?

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Actions
>    Affects Versions: 2.0.6
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Priority: Minor
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-1960) action tag violates ParameterAware contract

Posted by "Claudio Pozzoli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46389#action_46389 ] 

Claudio Pozzoli commented on WW-1960:
-------------------------------------

Doesn't this patch break some (legal?) usages of the "s:action" tag as well? We were used to pass actual objects to the action in order to create handy "widgets" used across the whole site, e.g.:


struts-widgets.xml:

<package name="widgets" namespace="/widgets" extends="struts-default">
    <default-interceptor-ref name="i18nStack" />
    ...
    <action name="dummyService" class="com.examples.widgets.ServicesAction" method="dummyService">
	<result>dummyServiceWidget.jsp</result>
    </action>
    ...
</package>


container.jsp:

<s:action namespace="/widgets" name="dummyService" executeResult="true">
    <s:param name="actualParam"     value="expensiveObject.beanList[index]" />
</s:action>


ServicesAction.java:

public class ServicesAction extends ActionSupport
{
    ... 
    // parameters
    private BeanType actualParam;

    public String dummyService() throws Exception
    {
        // use actualParam object...
    }

    public void setActualParam(BeanType actualParam)
    {
        this.actualParam = actualParam;
    }
    ...
}


This is a useful feature every time "s:action" gets repeatedly evaluated over a collection of parameters (getting back the object from a string identifier passed as parameter is not an option since it would be computationally expensive in our case).

Claudio

> action tag violates ParameterAware contract
> -------------------------------------------
>
>                 Key: WW-1960
>                 URL: https://issues.apache.org/struts/browse/WW-1960
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>         Environment: linux,jdk1.5,tomcat5.5
>            Reporter: David Mansfield
>            Assignee: Don Brown
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> the javadoc for ParameterAware states that the values of the map are all java.lang.String[], in other words it is a Map<String,String[]>.  Indeed, when hitting an action via a 'genuine' http request, this is true.  However, when hitting the action via the action tag, the values in the map are String, not String[].  The bug appears to be possibly line 177 in ActionComponent:
> 176:        if (parameters != null) {
> 177:            newParams.putAll(parameters);
> 178:        }
> The parameters of the component are Map<String,String> and therefore cannot be combined directly into the ActionContext.getParameters map.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.