<commit_before>
package edu.wustl.catissuecore.action;

// import edu.wustl.catissuecore.actionForm.DepartmentForm;
import java.io.IOException;
import java.io.PrintWriter;

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

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import edu.wustl.catissuecore.actionForm.InstitutionForm;
import edu.wustl.catissuecore.bizlogic.InstitutionBizLogic;
import edu.wustl.catissuecore.util.global.AppUtility;
import edu.wustl.catissuecore.util.global.Constants;
import edu.wustl.common.action.CommonAddEditAction;
import edu.wustl.common.exception.BizLogicException;
import edu.wustl.common.util.logger.Logger;

/**
 * @author renuka_bajpai
 */
public class AddInstitutionAction extends CommonAddEditAction
{

	/**
	 * logger.
	 */
	private transient final Logger logger = Logger.getCommonLogger(AddInstitutionAction.class);

	/**
	 * @param mapping : mapping
	 * @param form : form
	 * @param request : request
	 * @param response : response
	 * @throws IOException : IOException
	 * @throws ServletException : ServletException
	 * @return ActionForward
	 */
	@Override
	public ActionForward executeXSS(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		final String institutionName = request.getParameter(Constants.INSTITUTION_NAME);
		final InstitutionBizLogic bizlogic = new InstitutionBizLogic();
		String institutionId = null;
		String responseString = "";
		final InstitutionForm institutionForm = (InstitutionForm) form;

		institutionForm.setOperation(Constants.ADD);
		institutionForm.setName(institutionName);

		final ActionForward forward = super.executeXSS(mapping, institutionForm, request, response);

		if ((forward != null) && (forward.getName().equals(Constants.FAILURE)))
		{
			responseString = AppUtility.getResponseString(request, responseString);
		}
		else
		{
			try
			{
				institutionId = bizlogic.getLatestInstitution(institutionName);
				responseString = institutionId + Constants.RESPONSE_SEPARATOR + institutionName;
			}
			catch (final BizLogicException bizEx)
			{
				this.logger.error("Exception occurred in retrieving Institution",bizEx);
				bizEx.printStackTrace();
			}
		}
		final PrintWriter out = response.getWriter();
		response.setContentType("text/html");

		/**
		 * Sending the response
		 */
		out.write(responseString);

		return null;<commit_msg>* Task/Bug Id: removed printStacktrace and added logger * Code Reviewed By: <NAME> On : 16-7-10 * Technical Details:  <Technical details for the changes made if any> * Unit tested:   <Names of the test cases> * Developer Notes: <Free form comments, typically will involve names of the methods changed etc> * Current Build++ Counts for this file : <B++ counts before the file is checked-in> * PMD - X     Checkstyle - X     Findbugs - X     CPD – X<commit_after>
package edu.wustl.catissuecore.action;

// import edu.wustl.catissuecore.actionForm.DepartmentForm;
import java.io.IOException;
import java.io.PrintWriter;

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

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import edu.wustl.catissuecore.actionForm.InstitutionForm;
import edu.wustl.catissuecore.bizlogic.InstitutionBizLogic;
import edu.wustl.catissuecore.util.global.AppUtility;
import edu.wustl.catissuecore.util.global.Constants;
import edu.wustl.common.action.CommonAddEditAction;
import edu.wustl.common.exception.BizLogicException;
import edu.wustl.common.util.logger.Logger;

/**
 * @author renuka_bajpai
 */
public class AddInstitutionAction extends CommonAddEditAction
{

	/**
	 * logger.
	 */
	private transient final Logger logger = Logger.getCommonLogger(AddInstitutionAction.class);

	/**
	 * @param mapping : mapping
	 * @param form : form
	 * @param request : request
	 * @param response : response
	 * @throws IOException : IOException
	 * @throws ServletException : ServletException
	 * @return ActionForward
	 */
	@Override
	public ActionForward executeXSS(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		final String institutionName = request.getParameter(Constants.INSTITUTION_NAME);
		final InstitutionBizLogic bizlogic = new InstitutionBizLogic();
		String institutionId = null;
		String responseString = "";
		final InstitutionForm institutionForm = (InstitutionForm) form;

		institutionForm.setOperation(Constants.ADD);
		institutionForm.setName(institutionName);

		final ActionForward forward = super.executeXSS(mapping, institutionForm, request, response);

		if ((forward != null) && (forward.getName().equals(Constants.FAILURE)))
		{
			responseString = AppUtility.getResponseString(request, responseString);
		}
		else
		{
			try
			{
				institutionId = bizlogic.getLatestInstitution(institutionName);
				responseString = institutionId + Constants.RESPONSE_SEPARATOR + institutionName;
			}
			catch (final BizLogicException bizEx)
			{
				this.logger.error("Exception occurred in retrieving Institution",bizEx);
			}
		}
		final PrintWriter out = response.getWriter();
		response.setContentType("text/html");

		/**
		 * Sending the response
		 */
		out.write(responseString);

		return null;
{'fraction_non_alphanumeric': 0.09649595687331536, 'fraction_numerical': 0.0008984725965858042, 'mean_word_length': 5.036876355748373, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4044745', 'n_tokens_mistral': 1762, 'n_tokens_neox': 1602, 'n_words': 356}