Beehive
  1. Beehive
  2. BEEHIVE-779

ScopedRequestImpl.restoreAttributes() should not point the ScopedAttributeContainer at the Session's stored attribute HashMap instance

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: v1m1
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:
      None

      Description

      Currently the ScopedRequestImpl.restoreAttributes() assigns the
      ScopedAttributeContainer with the Session's stored attribute HashMap instance.
      If there are multiple requests to the server in very fast succession,
      this will cause the use of the HashMap iterator to throw a
      ConcurrentModificationException.

      The problem is that during both restoreAttributes() and persistAttributes()
      we are updating the session's instance of a HashMap. At the same time,
      in persisAttributes() the call to the ScopedAttributeContainer's
      getSerializableAttrs() uses the HashMap instance iterator
      (HashMap.HashIterator). If between calls to next() for the next
      MapEntry, and the number of elements in the Map gets altered,
      we get the ConcurrentModificationException...

      java.util.ConcurrentModificationException
      at java.util.HashMap$HashIterator.nextEntry()Ljava.util.HashMap$Entry;(Unknown Source)
      at java.util.HashMap$EntryIterator.next()Ljava.util.Map$Entry;(Unknown Source)
      at java.util.HashMap$EntryIterator.next()Ljava.lang.Object;(Unknown Source)
      at org.apache.beehive.netui.pageflow.scoping.internal.AttributeContainer.getSerializableAttrs(AttributeContainer.java:91)
      at org.apache.beehive.netui.pageflow.scoping.internal.ScopedRequestImpl.persistAttributes(ScopedRequestImpl.java:444)

      I will take this one and submit a patch for the committers.

      1. j779patch.txt
        1 kB
        Carlin Rogers

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        6d 1h 21m 1 Rich Feit 08/Jun/05 05:33
        Resolved Resolved Closed Closed
        9d 2h 55m 1 Carlin Rogers 17/Jun/05 08:28
        Carlin Rogers made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Carlin Rogers added a comment -

        Verfified the patch and fix. Thanks Rich.

        Show
        Carlin Rogers added a comment - Verfified the patch and fix. Thanks Rich.
        Carlin Rogers made changes -
        Environment
        Fix Version/s TBD [ 10950 ]
        Fix Version/s V1 [ 12310123 ]
        Assignee Rich Feit [ rich ] Carlin Rogers [ crogers ]
        Description Currently the ScopedRequestImpl.restoreAttributes() assigns the
        ScopedAttributeContainer with the Session's stored attribute HashMap instance.
        If there are multiple requests to the server in very fast succession,
        this will cause the use of the HashMap iterator to throw a
        ConcurrentModificationException.

        The problem is that during both restoreAttributes() and persistAttributes()
        we are updating the session's instance of a HashMap. At the same time,
        in persisAttributes() the call to the ScopedAttributeContainer's
        getSerializableAttrs() uses the HashMap instance iterator
        (HashMap.HashIterator). If between calls to next() for the next
        MapEntry, and the number of elements in the Map gets altered,
        we get the ConcurrentModificationException...

        java.util.ConcurrentModificationException
            at java.util.HashMap$HashIterator.nextEntry()Ljava.util.HashMap$Entry;(Unknown Source)
            at java.util.HashMap$EntryIterator.next()Ljava.util.Map$Entry;(Unknown Source)
            at java.util.HashMap$EntryIterator.next()Ljava.lang.Object;(Unknown Source)
            at org.apache.beehive.netui.pageflow.scoping.internal.AttributeContainer.getSerializableAttrs(AttributeContainer.java:91)
            at org.apache.beehive.netui.pageflow.scoping.internal.ScopedRequestImpl.persistAttributes(ScopedRequestImpl.java:444)


        I will take this one and submit a patch for the committers.
        Currently the ScopedRequestImpl.restoreAttributes() assigns the
        ScopedAttributeContainer with the Session's stored attribute HashMap instance.
        If there are multiple requests to the server in very fast succession,
        this will cause the use of the HashMap iterator to throw a
        ConcurrentModificationException.

        The problem is that during both restoreAttributes() and persistAttributes()
        we are updating the session's instance of a HashMap. At the same time,
        in persisAttributes() the call to the ScopedAttributeContainer's
        getSerializableAttrs() uses the HashMap instance iterator
        (HashMap.HashIterator). If between calls to next() for the next
        MapEntry, and the number of elements in the Map gets altered,
        we get the ConcurrentModificationException...

        java.util.ConcurrentModificationException
            at java.util.HashMap$HashIterator.nextEntry()Ljava.util.HashMap$Entry;(Unknown Source)
            at java.util.HashMap$EntryIterator.next()Ljava.util.Map$Entry;(Unknown Source)
            at java.util.HashMap$EntryIterator.next()Ljava.lang.Object;(Unknown Source)
            at org.apache.beehive.netui.pageflow.scoping.internal.AttributeContainer.getSerializableAttrs(AttributeContainer.java:91)
            at org.apache.beehive.netui.pageflow.scoping.internal.ScopedRequestImpl.persistAttributes(ScopedRequestImpl.java:444)


        I will take this one and submit a patch for the committers.
        Rich Feit made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Rich Feit added a comment -

        Applied the patch with revision 188851. Thanks!

        Show
        Rich Feit added a comment - Applied the patch with revision 188851. Thanks!
        Carlin Rogers made changes -
        Assignee Carlin Rogers [ crogers ] Rich Feit [ rich ]
        Hide
        Carlin Rogers added a comment -

        Assigning to Rich for review. Thanks.

        Show
        Carlin Rogers added a comment - Assigning to Rich for review. Thanks.
        Carlin Rogers made changes -
        Field Original Value New Value
        Attachment j779patch.txt [ 20370 ]
        Hide
        Carlin Rogers added a comment -

        This patch modifies the ScopedRequestImpl.restoreAttributes() method
        so that it no longer assigns the session stored attributes HashMap
        to the request ScopedAttributeContainer.

        The patch has a small format edit to a tiles sample file so that the
        format is consistent with the other page flows in the tiles sample.

        Show
        Carlin Rogers added a comment - This patch modifies the ScopedRequestImpl.restoreAttributes() method so that it no longer assigns the session stored attributes HashMap to the request ScopedAttributeContainer. The patch has a small format edit to a tiles sample file so that the format is consistent with the other page flows in the tiles sample.
        Carlin Rogers created issue -

          People

          • Assignee:
            Carlin Rogers
            Reporter:
            Carlin Rogers
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development