Tapestry 5
  1. Tapestry 5
  2. TAP5-891

RequestImpl.getSession(true) is broken

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.5
    • Fix Version/s: 5.3
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      I think that the implementation of org.apache.tapestry5.internal.services.RequestImpl.getSession(true) is broken.

      It returns an old invalidated session instead of creating a new.

      IMO this is a bug since it behaves differently than HttpServletRequest.getSession(true).

      This is the expected behaviour:

      1. Session s1 = request.getSession(true);
      2. s1.invalidate();
      3. Session s2 = request.getSession(true);
      4. assertNotNull(s2);
      5. assertNotSame(s1, s2);
      6. assertFalse(s2.isInvalidated());

      1. RequestImpl.java
        4 kB
        Olle Hallin
      2. RequestImplTest.java
        6 kB
        Olle Hallin

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        709d 1h 26m 1 Howard M. Lewis Ship 23/Sep/11 17:39
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Howard M. Lewis Ship [ hlship ]
        Fix Version/s 5.3 [ 12316024 ]
        Resolution Fixed [ 1 ]
        Hide
        Ulrich Stärk added a comment -

        Howard, I see you committed the fix, can this issue be closed?

        Show
        Ulrich Stärk added a comment - Howard, I see you committed the fix, can this issue be closed?
        Hide
        Hudson added a comment -

        Integrated in tapestry-5.2-freestyle #252 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/252/)

        Show
        Hudson added a comment - Integrated in tapestry-5.2-freestyle #252 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/252/ )
        Hide
        Andrew Khomyakov added a comment -

        Hello!
        How to replace existing RequestImpl with your implementation? Our project uses maven and it's not good idea to replace it inside the jar. Also I can not put it into the classpath, because we pack all java classes in jar.
        Also, if I write method buildHttpServletRequestHandler in our TapestryModule, the application does not start without any exception or any calls of this method.
        Could I write something in TapestryModule to make it work?

        Thanks

        Show
        Andrew Khomyakov added a comment - Hello! How to replace existing RequestImpl with your implementation? Our project uses maven and it's not good idea to replace it inside the jar. Also I can not put it into the classpath, because we pack all java classes in jar. Also, if I write method buildHttpServletRequestHandler in our TapestryModule, the application does not start without any exception or any calls of this method. Could I write something in TapestryModule to make it work? Thanks
        Olle Hallin made changes -
        Attachment RequestImpl.java [ 12422217 ]
        Attachment RequestImplTest.java [ 12422218 ]
        Hide
        Olle Hallin added a comment -

        I've attached a new RequestImpl.java which fixes the bug, and the accompanying unit test

        Show
        Olle Hallin added a comment - I've attached a new RequestImpl.java which fixes the bug, and the accompanying unit test
        Olle Hallin made changes -
        Field Original Value New Value
        Description I think that the implementation of org.apache.tapestry5.internal.services.RequestImpl.getSession(true) is broken.

        It returns an old invalidated session instead of creating a new.

        IMO this is a bug since it behaves differently than HttpServletRequest.getSession(true).

        This is expected behaviour:

        1. Session s1 = request.getSession(true);
        2. s1.invalidate();
        3. Session s2 = request.getSession(true);
        4. assertNotNull(s2);
        5. assertNotSame(s1, s2);
        6. assertFalse(s2.isInvalidated());

        I think that the implementation of org.apache.tapestry5.internal.services.RequestImpl.getSession(true) is broken.

        It returns an old invalidated session instead of creating a new.

        IMO this is a bug since it behaves differently than HttpServletRequest.getSession(true).

        This is the expected behaviour:

        1. Session s1 = request.getSession(true);
        2. s1.invalidate();
        3. Session s2 = request.getSession(true);
        4. assertNotNull(s2);
        5. assertNotSame(s1, s2);
        6. assertFalse(s2.isInvalidated());

        Olle Hallin created issue -

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Olle Hallin
          • Votes:
            4 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development