You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2010/06/09 00:58:23 UTC
svn commit: r952857 -
/myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java
Author: mfreedman
Date: Tue Jun 8 22:58:22 2010
New Revision: 952857
URL: http://svn.apache.org/viewvc?rev=952857&view=rev
Log:
testRequestScopeContents failed on WLP for because the test portlet removed request attributes at the end of the action in an inner loop that caused a concurrent modification exception. The fix for this is being checked-in -- the attribute names are now added to a list and removed after the loop.
Modified:
myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java
Modified: myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java?rev=952857&r1=952856&r2=952857&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java (original)
+++ myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java Tue Jun 8 22:58:22 2010
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
@@ -57,7 +58,7 @@ public class BridgeClearRequestScopePort
static final String MESSAGE_VALUE1 = "Test Message1 Retention.";
static final String MESSAGE_VALUE2 = "Test Message2 Retention.";
-
+
public void init(PortletConfig config)
throws PortletException
{
@@ -96,16 +97,24 @@ public class BridgeClearRequestScopePort
private void clearAttributes(ActionRequest r, Map<String, Object> m)
{
-
+ ArrayList<String> removeList = (ArrayList<String>) new ArrayList(10);
Enumeration<String> e = r.getAttributeNames();
while (e.hasMoreElements())
{
String key = e.nextElement();
if (!m.containsKey(key))
{
- r.removeAttribute(key);
+ // add to removeList so can remove after the loop to avoid potential ConcurrentModification Exceptions
+ removeList.add(key);
+
}
}
+
+ // Postpone the remove until after the iteration as it causes a ConcurrentModificationException on some appServers (WebSphere)
+ for(Iterator<String> iter = removeList.iterator(); iter.hasNext();)
+ {
+ r.removeAttribute(iter.next());
+ }
}
private void addLifecycleListener()