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

Igor Vaynberg resolved WICKET-2827.
-----------------------------------

         Assignee: Igor Vaynberg
    Fix Version/s: 1.4.11
       Resolution: Fixed

> Removed page might revive when push back-button
> -----------------------------------------------
>
>                 Key: WICKET-2827
>                 URL: https://issues.apache.org/jira/browse/WICKET-2827
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.7
>         Environment: Windows XP SP3 (32bit), Java 6.0 update 19, and Tomcat 
> 6.0.20
>            Reporter: IWAMURO Motonori
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.11
>
>         Attachments: expire-test.zip, removepage.patch, removepage2.patch
>
>
> Hi.
> The removed page might revive.
> This is caused in the following conditions:
> 1) "getPageMap().remove(this)" or "getPageMap().remove()" on onXXX() handler. 
> (e.g. Link#onClick())
> 2) Screen transition using "setResponsePage(NextPage.class)".
> 3) Push back-button on NextPage.
> 4) The removed page revive.
> This cause is as follows:
> a) When NextPage is displayed, the removed page remains in  
> "org.apache.wicket.protocol.http.SecondLevelCacheSessionStore.SecondLevelCachePageMap.lastPage".
> b) When the removed page is re-displayed by back-button, 
> SecondLevelCachePageMap.get(int, int) revive the page by lastPage.
> The problem doesn't happen when use "setResponsePage(new NextPage())" instead 
> of "setResponsePage(NextPage.class)".
> Because "lastPage" is overwritten by the instance of NextPage.
> It is my patch as follows:
> Index: 
> src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java
> ===================================================================
> --- 
> src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java
>    (revision 930858)
> +++ 
> src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java
>    (working copy)
> @@ -348,6 +348,7 @@
>                       {
>                               getStore().removePage(sessionId, getName(), -1);
>                       }
> +                     lastPage = null;
>               }
>  
>               /**
> @@ -361,6 +362,9 @@
>                       {
>                               getStore().removePage(sessionId, getName(), 
> entry.getNumericId());
>                       }
> +                     if (lastPage instanceof Page && ((Page) 
> lastPage).getPageMapEntry() == entry) {
> +                             lastPage = null;
> +                     }
>               }
>  
>               private IPageStore getStore()

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

Reply via email to