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

ASF GitHub Bot logged work on WW-5065:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Apr/20 19:00
            Start Date: 27/Apr/20 19:00
    Worklog Time Spent: 10m 
      Work Description: davelnewton commented on a change in pull request #410:
URL: https://github.com/apache/struts/pull/410#discussion_r416071496



##########
File path: 
core/src/main/java/com/opensymphony/xwork2/config/impl/AbstractMatcher.java
##########
@@ -192,7 +217,7 @@ protected String convertParam(String val, Map<String, 
String> vars) {
             c = val.charAt(x);
             if (x < len - 2 && 
                     c == '{' && '}' == val.charAt(x+2)) {
-                varVal = (String)vars.get(String.valueOf(val.charAt(x + 1)));
+                varVal = vars.get(String.valueOf(val.charAt(x + 1)));

Review comment:
       (NON-BLOCKER) Never thought about it or ran in to it, but do we throw a 
startup message or error if it's something *other* than 0-9 or has a spurious 
`{42}` or `{42` or is that just considered part of a valid, if silly, path?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 427787)
    Time Spent: 50m  (was: 40m)

> 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.5.23, 2.6
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to