/** * Try to handle given exception using execution exception handlers registered at the state level. Returns null if * no handler handled the exception. * @return true if the exception was handled */ private boolean tryStateHandlers(FlowExecutionException exception, RequestControlContext context) { if (exception.getStateId() != null) { State state = getActiveSessionInternal().getFlow().getStateInstance(exception.getStateId()); return state.handleException(exception, context); } else { return false; } }
/** * Try to handle given exception using execution exception handlers registered at the state level. Returns null if * no handler handled the exception. * @return true if the exception was handled */ private boolean tryStateHandlers(FlowExecutionException exception, RequestControlContext context) { if (exception.getStateId() != null) { return getCurrentFlow().getStateInstance(exception.getStateId()).handleException(exception, context); } else { return false; } }
/** * Try to handle given exception using execution exception handlers registered at the state level. Returns null if * no handler handled the exception. */ private ViewSelection tryStateHandlers(FlowExecutionException exception, RequestControlContext context) { if (isActive() && exception.getStateId() != null) { return getActiveFlow().getStateInstance(exception.getStateId()).handleException(exception, context); } else { return null; } }
/** * Try to handle given exception using execution exception handlers registered at the state level. Returns null if * no handler handled the exception. * @return true if the exception was handled */ private boolean tryStateHandlers(FlowExecutionException exception, RequestControlContext context) { if (exception.getStateId() != null) { State state = getActiveSessionInternal().getFlow().getStateInstance(exception.getStateId()); return state.handleException(exception, context); } else { return false; } }
public void testCouldNotHandleException() { FlowExecutionException e = new FlowExecutionException(flow.getId(), state.getId(), "Whatev"); MockRequestControlContext context = new MockRequestControlContext(flow); assertFalse(state.handleException(e, context)); }
public void testHandledException() { state.getExceptionHandlerSet().add(new FlowExecutionExceptionHandler() { public boolean canHandle(FlowExecutionException exception) { return true; } public void handle(FlowExecutionException exception, RequestControlContext context) { handled = true; } }); FlowExecutionException e = new FlowExecutionException(flow.getId(), state.getId(), "Whatev"); MockRequestControlContext context = new MockRequestControlContext(flow); assertTrue(state.handleException(e, context)); assertTrue(handled); }