The getApplicationMapTest calls PortletContext.getAttributeNames() and then compares the names/values with the Map returned by ExternalContext.getApplicationMap().

      The test failure occurs if there has been a postback issued during a prior test. When that happens, then the BridgeRequestScopeManagerImpl class will store an attribute named "com.liferay.faces.bridge.bridgeRequestScopeCache" in the Map. As the test is iterating through all of the attributes, it calls the ".equals(Object)" method on the BridgeRequestScopeCache Map. Since the BridgeRequestScopeCache Map is wrapped by Collections.synchronizedMap(Map), a ConcurrentModificationException gets thrown:

      	at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(
      	at java.util.LinkedHashMap$
      	at java.util.LinkedHashMap$
      	at java.util.AbstractMap.equals(
      	at java.util.Collections$SynchronizedMap.equals(
      	at org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_2.Tests.containsIdenticalAttributeEntries(
      	at org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_2.Tests.getApplicationMapTest(

      Steps to reproduce the problem:

      1. Click on "TestPage183"
      2. Verify that the test page reports success
      3. Click on "TestPage179"
      4. Click on the "Run Test" button, which will invoke a postback and create the BridgeRequestScopeCache
      5. Click on the "TestPage180" button
      6. Click on the "Run Test" button
      (note that steps 5 and 6 are probably not necessary, but those are the steps that I followed when reproducing the bug)
      7. Click back on "TestPage183"

      If the bug still exists, then the aforementioned exception will get thrown. If the bug is fixed, then the test page will report success.

      The solution to this problem is to stop using Collections.synchronizedMap and instead, have the BridgeRequestScopeCache extend ConcurrentHashMap. This will fix the ConcurrentModificationException, as described in the article Concurrent Collections.




            • Assignee:
              neil.griffin Neil Griffin
              neil.griffin Neil Griffin
              Participants of an Issue:
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: