<commit_before>/*
 * Copyright 2004-2005 the original author or authors.
 */
package org.springframework.web.flow;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.flow.action.AbstractActionBean;

/**
 * @author <NAME>
 */
public class MultiActionBean extends AbstractActionBean {

	private EventHandlerMethodNameResolver methodNameResolver = new DefaultEventHandlerMethodNameResolver();

	private static class DefaultEventHandlerMethodNameResolver implements EventHandlerMethodNameResolver {
		public String getMethodName(String eventId) {
			return "handle" + StringUtils.capitalize(eventId) + "Event";
		}
	}

	protected ActionBeanEvent doExecuteAction(HttpServletRequest request, HttpServletResponse response,
			MutableAttributesAccessor model) throws RuntimeException, ServletRequestBindingException {
		FlowSessionExecutionInfo sessionExecution = FlowUtils.getFlowSessionExecutionInfo(model);
		String eventId = sessionExecution.getLastEventId();
		String handlerMethodName = methodNameResolver.getMethodName(eventId);
		try {
			Method handlerMethod = getDelegate().getClass().getMethod(handlerMethodName,
					new Class[] { HttpServletRequest.class, HttpServletResponse.class, AttributesAccessor.class });
			return (ActionBeanEvent)handlerMethod.invoke(getDelegate(), new Object[] { request, response, model });
		}
		catch (NoSuchMethodException e) {
			throw new RuntimeException("Exception occured dispatching action by reflection on event '" + eventId + "'",
					e);
		}
		catch (IllegalAccessException e) {
			throw new RuntimeException("Exception occured dispatching action by reflection on event '" + eventId + "'",
					e);
		}
		catch (InvocationTargetException e) {
			Throwable target = e.getTargetException();
			Assert.isTrue(target instanceof RuntimeException,
					"Action bean handlers should only throw runtime exceptions - programmer error");
			throw (RuntimeException)target;
		}
	}

	protected Object getDelegate() {
		return this;
	}

}<commit_msg>*** empty log message ***<commit_after>/*
 * Copyright 2004-2005 the original author or authors.
 */
package org.springframework.web.flow;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.flow.action.AbstractActionBean;

/**
 * @author <NAME>
 */
public class MultiActionBean extends AbstractActionBean {

	private EventHandlerMethodNameResolver methodNameResolver = new DefaultEventHandlerMethodNameResolver();

	private static class DefaultEventHandlerMethodNameResolver implements EventHandlerMethodNameResolver {
		public String getMethodName(String eventId) {
			return "handle" + StringUtils.capitalize(eventId) + "Event";
		}
	}

	protected ActionBeanEvent doExecuteAction(HttpServletRequest request, HttpServletResponse response,
			MutableAttributesAccessor model) throws RuntimeException, ServletRequestBindingException {
		FlowSessionExecutionInfo sessionExecution = FlowUtils.getFlowSessionExecutionInfo(model);
		String eventId = sessionExecution.getLastEventId();
		String handlerMethodName = methodNameResolver.getMethodName(eventId);
		try {
			Method handlerMethod = getHandlerMethod(handlerMethodName);
			return (ActionBeanEvent)handlerMethod.invoke(getDelegate(), new Object[] { request, response, model });
		}
		catch (NoSuchMethodException e) {
			throw new RuntimeException("Exception occured dispatching action by reflection on event '" + eventId + "'",
					e);
		}
		catch (IllegalAccessException e) {
			throw new RuntimeException("Exception occured dispatching action by reflection on event '" + eventId + "'",
					e);
		}
		catch (InvocationTargetException e) {
			Throwable target = e.getTargetException();
			Assert.isTrue(target instanceof RuntimeException,
					"Action bean handlers should only throw runtime exceptions - programmer error");
			throw (RuntimeException)target;
		}
	}

	protected Method getHandlerMethod(String eventHandlerMethodName) throws NoSuchMethodException,
			IllegalAccessException {
		return getDelegate().getClass().getMethod(eventHandlerMethodName,
				new Class[] { HttpServletRequest.class, HttpServletResponse.class, AttributesAccessor.class });
	}

	protected Object getDelegate() {
		return this;
	}

}
{'fraction_non_alphanumeric': 0.08486622073578595, 'fraction_numerical': 0.0033444816053511705, 'mean_word_length': 5.985401459854015, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6986033', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1181, 'n_words': 301}