Author: mrdon
Date: Sat Jun 17 12:14:09 2006
New Revision: 415046
URL: http://svn.apache.org/viewvc?rev=415046&view=rev
Log:
Fixing potential recurision problem with ActionContext cleanup in
Weblogic. Patch provided by Pete Matern
WW-1335
Modified:
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/dispatcher/ActionContextCleanUp.java
Modified:
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/dispatcher/ActionContextCleanUp.java
URL:
http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/java/org/apache/struts/action2/dispatcher/ActionContextCleanUp.java?rev=415046&r1=415045&r2=415046&view=diff
==============================================================================
---
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/dispatcher/ActionContextCleanUp.java
(original)
+++
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/dispatcher/ActionContextCleanUp.java
Sat Jun 17 12:14:09 2006
@@ -55,7 +55,7 @@
private static final Log LOG =
LogFactory.getLog(ActionContextCleanUp.class);
- private static final String CLEANUP_PRESENT = "__cleanup_present";
+ private static final String COUNTER = "__cleanup_recursion_counter";
protected FilterConfig filterConfig;
@@ -89,20 +89,29 @@
}
try {
- request.setAttribute(CLEANUP_PRESENT, Boolean.TRUE);
+ Integer count = (Integer)request.getAttribute(COUNTER);
+ if (count == null) {
+ count = new Integer(1);
+ }
+ else {
+ count = new Integer(count.intValue()+1);
+ }
+ request.setAttribute(COUNTER, count);
chain.doFilter(request, response);
} finally {
- request.setAttribute(CLEANUP_PRESENT, Boolean.FALSE);
+ int counterVal =
((Integer)request.getAttribute(COUNTER)).intValue();
+ counterVal -= 1;
+ request.setAttribute(COUNTER, new Integer(counterVal));
cleanUp(request);
}
}
protected static void cleanUp(ServletRequest req) {
// should we clean up yet?
- Boolean dontClean = (Boolean) req.getAttribute(CLEANUP_PRESENT);
- if (dontClean != null && dontClean.booleanValue()) {
- return;
- }
+ if (req.getAttribute(COUNTER) != null &&
+ ((Integer)req.getAttribute(COUNTER)).intValue() > 0 ) {
+ return;
+ }
// tear down the component manager if it was created
ComponentManager componentManager = (ComponentManager)
req.getAttribute(ComponentManager.COMPONENT_MANAGER_KEY);