Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2827

Removed page might revive when push back-button

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.7
    • 1.4.11
    • wicket
    • None
    • Windows XP SP3 (32bit), Java 6.0 update 19, and Tomcat 6.0.20

    Description

      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()

      Attachments

        1. expire-test.zip
          21 kB
          IWAMURO Motonori
        2. removepage.patch
          0.7 kB
          IWAMURO Motonori
        3. removepage2.patch
          0.6 kB
          IWAMURO Motonori

        Activity

          People

            ivaynberg Igor Vaynberg
            vmi IWAMURO Motonori
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: