diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java index 7e1bbf31..e2ccca50 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java @@ -581,28 +581,8 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { * @param context the request control context the exception occurred in * @throws FlowExecutionException re-throws the exception if it was not handled at the state or flow level */ - private void handleException(FlowExecutionException exception, RequestControlContext context) - throws FlowExecutionException { - handleException(exception, context, 1); - } - - /** - * This is an overloaded method for {@link #handleException(FlowExecutionException, RequestControlContext)} adding a - * handleExceptionCount argument that can be used to prevent infinite recursion. - * - * @param exception the exception that occurred - * @param context the request control context the exception occurred in - * @param handleExceptionCount the number of recursive attempts made at exception handling - */ - private void handleException(FlowExecutionException exception, RequestControlContext context, - int handleExceptionCount) { + private void handleException(FlowExecutionException exception, RequestControlContext context) { listeners.fireExceptionThrown(context, exception); - if (handleExceptionCount > 5) { - if (logger.isDebugEnabled()) { - logger.debug("Exception not handled after 5 tries, aborting exception handling of [" + exception + "]"); - } - throw exception; - } if (logger.isDebugEnabled()) { if (exception.getCause() != null) { logger.debug("Attempting to handle [" + exception + "] with root cause [" + getRootCause(exception) @@ -621,7 +601,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } } catch (FlowExecutionException newException) { // exception handling itself resulted in a new FlowExecutionException, try to handle it - handleException(newException, context, handleExceptionCount + 1); + handleException(newException, context); handled = true; } if (!handled) { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java index c570f555..8ebc1bfa 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/impl/FlowExecutionImplTests.java @@ -270,25 +270,6 @@ public class FlowExecutionImplTests extends TestCase { assertEquals(2, exceptionHandler.getHandleCount()); } - public void testExceptionHandledAvoidEndlessRecursion() { - Flow flow = new Flow("flow"); - ExceptionThrowingExceptionHandler exceptionHandler = new ExceptionThrowingExceptionHandler(false); - flow.getExceptionHandlerSet().add(exceptionHandler); - new State(flow, "state") { - protected void doEnter(RequestControlContext context) throws FlowExecutionException { - throw new FlowExecutionException("flow", "state", "Oops"); - } - }; - FlowExecutionImpl execution = new FlowExecutionImpl(flow); - MockExternalContext context = new MockExternalContext(); - try { - execution.start(null, context); - fail("Should have aborted exception handling after 5 tries"); - } catch (FlowExecutionException e) { - assertEquals(5, exceptionHandler.handleCount); - } - } - public void testStartCannotCallTwice() { Flow flow = new Flow("flow"); new EndState(flow, "end");