<commit_before>package gov.nih.nci.calab.ui.workflow;

/**
 * This class shows the view aliquot page .
 * 
 * @author pansu
 */

/* CVS $Id: ViewAliquotAction.java,v 1.2 2006-04-07 15:30:05 pansu Exp $*/

import gov.nih.nci.calab.dto.administration.AliquotBean;
import gov.nih.nci.calab.service.workflow.ExecuteWorkflowService;
import gov.nih.nci.calab.ui.core.AbstractBaseAction;

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

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.DynaActionForm;

public class ViewAliquotAction extends AbstractBaseAction {
	private static Logger logger = Logger.getLogger(ViewAliquotAction.class);

	public ActionForward executeTask(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ActionForward forward = null;
		String aliquotId = null;
		try {
			DynaActionForm theForm = (DynaActionForm) form;
			aliquotId = (String) theForm.get("aliquotId");

			ExecuteWorkflowService executeWorkflowService = new ExecuteWorkflowService();
			AliquotBean aliquot=executeWorkflowService.getAliquot(aliquotId);
			request.setAttribute("aliquot", aliquot);
			forward = mapping.findForward("success");
		} catch (Exception e) {
			logger.error("Caught exception when showing aliquot.", e);
			ActionMessages errors = new ActionMessages();
			ActionMessage error = new ActionMessage("error.viewAliquot",
					aliquotId);
			errors.add("error", error);
			saveMessages(request, errors);
			forward = mapping.findForward("failure");
		}
		return forward;
	}

	public boolean loginRequired() {
		return true;
	}

}
<commit_msg>added null check<commit_after>package gov.nih.nci.calab.ui.workflow;

/**
 * This class shows the view aliquot page .
 * 
 * @author pansu
 */

/* CVS $Id: ViewAliquotAction.java,v 1.3 2006-04-11 18:26:17 pansu Exp $*/

import gov.nih.nci.calab.dto.administration.AliquotBean;
import gov.nih.nci.calab.service.workflow.ExecuteWorkflowService;
import gov.nih.nci.calab.ui.core.AbstractBaseAction;

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

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.DynaActionForm;

public class ViewAliquotAction extends AbstractBaseAction {
	private static Logger logger = Logger.getLogger(ViewAliquotAction.class);

	public ActionForward executeTask(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ActionForward forward = null;
		String aliquotId = null;
		try {
			DynaActionForm theForm = (DynaActionForm) form;
			aliquotId = (String) theForm.get("aliquotId");

			ExecuteWorkflowService executeWorkflowService = new ExecuteWorkflowService();
			AliquotBean aliquot = executeWorkflowService.getAliquot(aliquotId);
			if (aliquot != null) {
				request.setAttribute("aliquot", aliquot);
				forward = mapping.findForward("success");
			} else {
				logger.error("Can't find an aliquot by the given ID");
				ActionMessages errors = new ActionMessages();
				ActionMessage error = new ActionMessage(
						"error.viewAliquot.noresult", aliquotId);
				errors.add("error", error);
				saveMessages(request, errors);
				forward = mapping.findForward("failure");
			}
		} catch (Exception e) {
			logger.error("Caught exception when showing aliquot.", e);
			ActionMessages errors = new ActionMessages();
			ActionMessage error = new ActionMessage("error.viewAliquot",
					aliquotId);
			errors.add("error", error);
			saveMessages(request, errors);
			forward = mapping.findForward("failure");
		}
		return forward;
	}

	public boolean loginRequired() {
		return true;
	}

}

{'fraction_non_alphanumeric': 0.10689572894297304, 'fraction_numerical': 0.008112622285850633, 'mean_word_length': 5.014347202295553, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7246463', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1267, 'n_words': 271}