struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Kaiser (Jira)" <j...@apache.org>
Subject [jira] [Commented] (WW-5065) AbstractMatcher adds values to the map passed into replaceParameters
Date Sun, 05 Apr 2020 19:01:00 GMT

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

Alex Kaiser commented on WW-5065:
---------------------------------

[~aleksandr-m] I think that the replaceParameters method still need to do as it says and replace
parameters, but it doesn't need to add to the parameter map.  So the method just needs to
be fixed, not removed, and once fixed it should still support the example you mentioned above 
(See Lukasz's comment about the second part of the method being removed in: [http://mail-archives.apache.org/mod_mbox/struts-dev/202004.mbox/%3CCAMopvkPWUv%3Drg6FreSDQkYqsowLGrV_%3Dr-QH6SZvfx4g_H6a5w%40mail.gmail.com%3E]). 
However I'll make sure to test this case out to make sure it still works.

[~lukaszlenart] For my uses I would like to see it in the 2.5.x branch, but I have no idea
what the implications of that are.  For example what is the difference of possible release
date of the next 2.5.x release vs. the 2.6 release?  Is there additional risk to putting
it in the 2.5.x release branch?  I'll let you make the call here.  I'll be working on submitting
the PR later today.

> AbstractMatcher adds values to the map passed into replaceParameters
> --------------------------------------------------------------------
>
>                 Key: WW-5065
>                 URL: https://issues.apache.org/jira/browse/WW-5065
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.5.22
>            Reporter: Alex Kaiser
>            Priority: Minor
>             Fix For: 2.6
>
>
> There is a bug with the AbstractMatcher#replaceParameters method in struts/core/src/main/java/com/opensymphony/xwork2/config/impl/AbstractMatcher.java
(currently lines 153-170). As the function currently works it will return a map that has more
keys than the "orig" map that is passed into it. For example, assume that I have the following
config defined in my struts.xml file:
> {code:java}
> <package name="test" namespace="/test">
>   <action name="{paramOne}/{paramTwo} class="org.MyActionClass" method="execute">
>     <result name="success" type="stream">
>       <param name="inputName">random</param>
>     </result>
>   </action>
> </package>{code}
> If you send a request to "/test/uno/dos", this will trigger code in ActionConfigMatcher
(lines 95-103) that will construct the ResultConfig objects to be used later on. At one point
you are going to be making a call to AbstractMatcher#replaceParameters with something that
looks like the following:
> orig:
>    "inputName" -> "random"
> vars:
>    "0" -> "uno/dos"
>    "paramOne" -> "uno"
>    "1" -> "uno"
>    "paramTwo" -> "dos"
>    "2" -> "dos"
> The result of this will be a map that looks like:
>    "inputName" -> "random"
>    "paramOne" -> "uno"
>    "paramTwo" -> "dos"
> The bug is that "paramOne" and "paramTwo" should not be in the return map.
> For the most part this but won't cause any problems but it will cause some performance
problems in certain situations when trying to set these parameters on the results objects
that aren't expecting them.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message