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

Martin Grigorov reassigned WICKET-3431:
---------------------------------------

    Assignee: Martin Grigorov

>  org/apache/wicket/util/tester/BaseWicketTester.java add cookie twice
> ---------------------------------------------------------------------
>
>                 Key: WICKET-3431
>                 URL: https://issues.apache.org/jira/browse/WICKET-3431
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-RC1
>         Environment: all
>            Reporter: Richard Emberson
>            Assignee: Martin Grigorov
>            Priority: Trivial
>
> Consider the clearCookie method.
> The WicketTesterServletWebResponse clearCookie calls the
> super class (ServletWebResponse) clearCookie method which
> (amoung other things) calls the addCookie method.
> Because of polymorphism, this calls the WicketTesterServletWebResponse
> addCookie which adds the cookie to the cookies List.
> Then the WicketTesterServletWebResponse clearCookie
> method adds the cookie a second time to the cookies List.
> Unless it is useful to have the same cookie in the List
> more than once, the List could be a Set.
> private static class WicketTesterServletWebResponse
>   extends ServletWebResponse
>   mplements IMetaDataBufferingWebResponse {
> ...
>   @Override
>   public void addCookie(Cookie cookie) {
>     super.addCookie(cookie);
>     cookies.add(cookie);
>   }                         
>   @Override                     
>   public void clearCookie(Cookie cookie) {
>     super.clearCookie(cookie);  
>     cookies.add(cookie);        
>   }                             
> ...
> }
> public class ServletWebResponse extends WebResponse {
> ...
>   @Override
>   public void addCookie(Cookie cookie) {
>     httpServletResponse.addCookie(cookie);
>   }
>   @Override
>   public void clearCookie(Cookie cookie) {
>     cookie.setMaxAge(0);
>     cookie.setValue(null);
>     addCookie(cookie);
>   }
> ...
> }

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

        

Reply via email to