Object argsMasterDegreeProofVersion[] = { infoStudentCurricularPlan };
Object argsMasterDegreeProofVersion[] = { studentCurricularPlanID };
    public ActionForward chooseFinal(ActionMapping mapping, ActionForm form, HttpServletRequest request,            HttpServletResponse response) throws Exception {        HttpSession session = request.getSession(false);        if (session != null) {            //remove sessions variables            session.removeAttribute(SessionConstants.INFO_STUDENT_CURRICULAR_PLAN);            session.removeAttribute(SessionConstants.MASTER_DEGREE_THESIS_DATA_VERSION);            session.removeAttribute(SessionConstants.MASTER_DEGREE_PROOF_HISTORY);            session.removeAttribute(SessionConstants.DEGREE_TYPE);            session.removeAttribute(SessionConstants.DATE);            IUserView userView = (IUserView) session.getAttribute(SessionConstants.U_VIEW);            String certificateString = (String) session.getAttribute(SessionConstants.CERTIFICATE_TYPE);            Integer studentCurricularPlanID = (Integer) request.getAttribute("studentCurricularPlanID");            if (studentCurricularPlanID == null) {                studentCurricularPlanID = Integer.valueOf(request                        .getParameter("studentCurricularPlanID"));            }            InfoStudentCurricularPlan infoStudentCurricularPlan = null;            Object args[] = { studentCurricularPlanID };            try {                infoStudentCurricularPlan = (InfoStudentCurricularPlan) ServiceManagerServiceFactory                        .executeService(userView, "ReadStudentCurricularPlan", args);            } catch (NonExistingServiceException e) {                throw new NonExistingActionException("O aluno");            }          int initialYear = infoStudentCurricularPlan.getInfoDegreeCurricularPlan().getInitialDate()                    .getYear() + 1900;            String initialExecutionYear = initialYear + "/" + ++initialYear;            request.setAttribute("initialExecutionYear", initialExecutionYear);            InfoMasterDegreeThesisDataVersion infoMasterDegreeThesisDataVersion = null;            InfoMasterDegreeProofVersion infoMasterDegreeProofVersion = null;            InfoExecutionYear infoExecutionYear = null;            try {                if (certificateString.equals("Fim de curso de Mestrado discriminada com mdia")                        || certificateString.equals("Fim de curso de Mestrado simples")) {                    Object argsMasterDegreeThesisDataVersion[] = { infoStudentCurricularPlan };                    try {                        infoMasterDegreeThesisDataVersion = (InfoMasterDegreeThesisDataVersion) ServiceUtils                                .executeService(                                        userView,                                        "ReadActiveMasterDegreeThesisDataVersionByStudentCurricularPlan",                                        argsMasterDegreeThesisDataVersion);                    } catch (NonExistingServiceException e) {                        throw new NonExistingActionException("O registo da tese ", e);                    }                    /* * * get master degree proof * * */                    Object argsMasterDegreeProofVersion[] = { infoStudentCurricularPlan };                    try {                        infoMasterDegreeProofVersion = (InfoMasterDegreeProofVersion) ServiceUtils                                .executeService(userView,                                        "ReadActiveMasterDegreeProofVersionByStudentCurricularPlan",                                        argsMasterDegreeProofVersion);                    } catch (NonExistingServiceException e) {                        throw new NonExistingActionException("O registo da tese ", e);                    } catch (ScholarshipNotFinishedServiceException e) {                        throw new ScholarshipNotFinishedActionException("", e);                    }                }                infoExecutionYear = (InfoExecutionYear) ServiceManagerServiceFactory.executeService(                        userView, "ReadCurrentExecutionYear", null);            } catch (RuntimeException e) {                throw new RuntimeException("Error", e);            }            Locale locale = new Locale("pt", "PT");            Date date = new Date();            String formatedDate = "Lisboa, "                    + DateFormat.getDateInstance(DateFormat.LONG, locale).format(date);            session.setAttribute(SessionConstants.DATE, formatedDate);            session.setAttribute(SessionConstants.MASTER_DEGREE_THESIS_DATA_VERSION,                    infoMasterDegreeThesisDataVersion);            session.setAttribute(SessionConstants.MASTER_DEGREE_PROOF_HISTORY,                    infoMasterDegreeProofVersion);            session.setAttribute(SessionConstants.INFO_EXECUTION_YEAR, infoExecutionYear);            session.setAttribute(SessionConstants.INFO_STUDENT_CURRICULAR_PLAN,                    infoStudentCurricularPlan);            return mapping.findForward("ChooseSuccess");        }        throw new Exception();    }