Commits

Anonymous committed 02b3215

Issue number: XW-160
removed recursion detection

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@185e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (2)

src/java/com/opensymphony/xwork/interceptor/ChainingInterceptor.java

  */
 package com.opensymphony.xwork.interceptor;
 
-import com.opensymphony.xwork.ActionContext;
 import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.XworkException;
 import com.opensymphony.xwork.util.CompoundRoot;
 import com.opensymphony.xwork.util.OgnlUtil;
 import com.opensymphony.xwork.util.OgnlValueStack;
  * @version $Revision$
  */
 public class ChainingInterceptor extends AroundInterceptor {
-    //~ Static fields/initializers /////////////////////////////////////////////
-
-    public static final String ACTION_CONTEXT_CHAIN_DEPTH = "com.opensymphony.xwork.interceptor.ChainingInterceptor.CHAIN_DEPTH";
-
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    // to prevent infinite recursion, only allow X chains within the same request
-    private int maxChainDepth = 100;
-
     //~ Methods ////////////////////////////////////////////////////////////////
 
-    public void setMaxChainDepth(int maxChainDepth) {
-        this.maxChainDepth = maxChainDepth;
-    }
-
     protected void after(ActionInvocation invocation, String result) throws Exception {
-        incrementChainDepth();
     }
 
     protected void before(ActionInvocation invocation) throws Exception {
-        int currentDepth = currentChainDepth();
-
-        if (currentDepth > (maxChainDepth + 1)) {
-            throw new XworkException("Chain infinite recursion detected, maxChainDepth=" + maxChainDepth);
-        }
-
         OgnlValueStack stack = invocation.getStack();
         CompoundRoot root = stack.getRoot();
 
             }
         }
     }
-
-    private int currentChainDepth() {
-        Integer chainDepth = (Integer) ActionContext.getContext().get(ACTION_CONTEXT_CHAIN_DEPTH);
-
-        if (chainDepth == null) {
-            return 0;
-        } else {
-            return chainDepth.intValue();
-        }
-    }
-
-    private void incrementChainDepth() {
-        ActionContext.getContext().put(ACTION_CONTEXT_CHAIN_DEPTH, new Integer(currentChainDepth() + 1));
-    }
 }

src/test/com/opensymphony/xwork/interceptor/ChainingInterceptorTest.java

         }
     }
 
-    public void testPropertiesChained() throws Exception {
-        TestBean bean = new TestBean();
-        TestBeanAction action = new TestBeanAction();
-        mockInvocation.matchAndReturn("getAction", action);
-        bean.setBirth(new Date());
-        bean.setName("foo");
-        bean.setCount(1);
-        stack.push(bean);
-        stack.push(action);
-        interceptor.intercept(invocation);
-        assertEquals(bean.getBirth(), action.getBirth());
-        assertEquals(bean.getName(), action.getName());
-        assertEquals(bean.getCount(), action.getCount());
-    }
-
-    public void testToManyChains() throws Exception {
-        int max = 5;
-        interceptor.setMaxChainDepth(max);
-
-        TestBean bean = new TestBean();
-        TestBeanAction action = new TestBeanAction();
-        mockInvocation.matchAndReturn("getAction", action);
-        bean.setBirth(new Date());
-        bean.setName("foo");
-        bean.setCount(1);
-        stack.push(bean);
-        stack.push(action);
-
-        try {
-            for (int i = 0; i < (max + 1); i++) {
-                interceptor.intercept(invocation);
-            }
-
-            fail("should have aborted recursive chain");
-        } catch (Exception e) {
-        }
-    }
-
     protected void setUp() throws Exception {
         super.setUp();
         stack = new OgnlValueStack();