[ 
https://issues.apache.org/jira/browse/VELTOOLS-148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christopher Schultz resolved VELTOOLS-148.
------------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.x

Fixed in r1151642:

New view.tools.LinkTool.duplicate(boolean) method.
New unit test.


> LinkTool.addAllParameters causes "ignored" parameters to pollute parent link 
> objects
> ------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-148
>                 URL: https://issues.apache.org/jira/browse/VELTOOLS-148
>             Project: Velocity Tools
>          Issue Type: Bug
>          Components: VelocityView
>    Affects Versions: 2.0
>         Environment: Velocity 1.7, Velocity-Tools 2.0
>            Reporter: Christopher Schultz
>             Fix For: 2.0.x
>
>
> The following code will not perform as expected with $link represents an 
> instance of view.tools.LinkTool:
> #set($forward = $link.setRelative('/foo').addQueryData('bar', 'baz'))
> one = $forward.addAllParameters()<br />
> two = $forward.addAllParameters()<br />
> The "addQueryData" appears to be required in order to make this fail.
> The addAllParameters method calls view.LinkTool.addRequestParamsExcept which 
> calls view.LinkTool.addRequestParams which calls generic.LinkTool.duplicate() 
> in order to duplicate the LinkTool before calling view.tools.setParam 
> repeatedly on it.
> generic.LinkTool.duplicate clones the LinkTool object including the 
> view.tools.LinkTool's reference to the "parametersToIgnore" field. The 
> "child" instances of this LinkTool will then have their "ignores" list 
> bleed-into the parent (and also other siblings) and the ultimate effect is 
> that LinkTool objects derived from that common root will be unable to call 
> addAllParameters() because all parameters will have been added to that 
> ignores list after the first invocation.
> The obvious solution seems to be that view.tools.LinkTool needs to override 
> the duplicate(boolean) method in order to clone the ignores list.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to