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:57:03 UTC
svn commit: r952855 -
/myfaces/portlet-bridge/tck/trunk_2.0.x/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:57:03 2010
New Revision: 952855
URL: http://svn.apache.org/viewvc?rev=952855&view=rev
Log:
testRequestScopeContents failed on WLP for 2 reasons -- one 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. -- 2nd -- the java.servlet attributes were being retained internally (shared on the portal request) because that is the WLP default -- setting a portlet specific container runtime option fixes this -- though as this is WLP specific I am not checking this in -- rather it will get added when WLP picks up the TCK.
Modified:
myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java
Modified: myfaces/portlet-bridge/tck/trunk_2.0.x/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/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java?rev=952855&r1=952854&r2=952855&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java (original)
+++ myfaces/portlet-bridge/tck/trunk_2.0.x/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_5/section_5_1_2/BridgeClearRequestScopePortlet.java Tue Jun 8 22:57:03 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()