newEnrolmentList.add(infoEnrolment2);
    public ActionForward chooseFinal(ActionMapping mapping, ActionForm form, HttpServletRequest request,            HttpServletResponse response) throws Exception {        HttpSession session = request.getSession(false);        if (session != null) {            IUserView userView = getUserView(request);            session.removeAttribute(SessionConstants.INFO_STUDENT_CURRICULAR_PLAN);            session.removeAttribute(SessionConstants.DATE);            session.removeAttribute(SessionConstants.INFO_FINAL_RESULT);            session.removeAttribute(SessionConstants.ENROLMENT_LIST);            session.removeAttribute(SessionConstants.INFO_EXECUTION_YEAR);            session.removeAttribute(SessionConstants.CONCLUSION_DATE);            session.removeAttribute(SessionConstants.INFO_BRANCH);            session.removeAttribute("total");            session.removeAttribute("givenCredits");            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");            }            List enrolmentList = null;            InfoFinalResult infoFinalResult = null;            try {                Object argsFinalResult[] = { infoStudentCurricularPlan };                infoFinalResult = (InfoFinalResult) ServiceManagerServiceFactory.executeService(                        userView, "FinalResult", argsFinalResult);            } catch (FenixServiceException e) {                throw new FenixServiceException("");            }            if (infoFinalResult == null) {                throw new FinalResulUnreachedActionException("");            }            try {                Object argsEnrolmentList[] = { infoStudentCurricularPlan.getIdInternal(),                        EnrollmentState.APROVED };                enrolmentList = (List) ServiceManagerServiceFactory.executeService(userView,                        "GetEnrolmentList", argsEnrolmentList);            } catch (NonExistingServiceException e) {                throw new NonExistingActionException("Inscrio", e);            }            if (enrolmentList.size() == 0) {                throw new NonExistingActionException("Inscrio em Disciplinas");            }            String conclusionDate = null;            Date endOfScholarshipDate = null;            try {                Object argsTemp[] = { studentCurricularPlanID };                endOfScholarshipDate = (Date) ServiceManagerServiceFactory.executeService(userView,                        "GetEndOfScholarshipDate", argsTemp);            } catch (FenixServiceException e) {                throw new FenixActionException(e);            }            conclusionDate = Data.format2DayMonthYear(endOfScholarshipDate, "/");            Date dateConclusion = Data.convertStringDate(conclusionDate, "/");            conclusionDate = DateFormat.getDateInstance().format(dateConclusion);            //String dataAux = null;            Object result = null;                        List newEnrolmentList = new ArrayList();            //get the last enrolmentEvaluation            Iterator iterator1 = enrolmentList.iterator();            double sum = 0;            while (iterator1.hasNext()) {                result = iterator1.next();                InfoEnrolment infoEnrolment2 = (InfoEnrolment) result;                InfoCurricularCourse infoCurricularCourse = infoEnrolment2.getInfoCurricularCourse();                sum = sum + Double.parseDouble(String.valueOf(infoCurricularCourse.getCredits()));            }            if ((infoStudentCurricularPlan.getGivenCredits() != null)                    && !infoStudentCurricularPlan.getGivenCredits().equals(new Double(0))) {                sum = sum                        + Double                                .parseDouble(String.valueOf(infoStudentCurricularPlan.getGivenCredits()));                session.setAttribute("givenCredits", "POR ATRIBUIO DE CRDITOS");            }            BigDecimal roundedSum = new BigDecimal(sum);            session.setAttribute("total", roundedSum.setScale(1, BigDecimal.ROUND_HALF_UP));//.toBigInteger());            session.setAttribute(SessionConstants.CONCLUSION_DATE, conclusionDate);            try {                ServiceManagerServiceFactory.executeService(userView, "ReadCurrentExecutionYear", null);            } catch (RuntimeException e) {                throw new RuntimeException("Error", e);            }            Locale locale = new Locale("pt", "PT");            Date date = new Date();            String anoLectivo = "";            if (newEnrolmentList != null && newEnrolmentList.size() > 0) {                anoLectivo = ((InfoEnrolment) newEnrolmentList.get(0)).getInfoExecutionPeriod()                        .getInfoExecutionYear().getYear();            }            String formatedDate = "Lisboa, "                    + DateFormat.getDateInstance(DateFormat.LONG, locale).format(date);            session.setAttribute(SessionConstants.INFO_STUDENT_CURRICULAR_PLAN,                    infoStudentCurricularPlan);            session.setAttribute(SessionConstants.DATE, formatedDate);            if (infoStudentCurricularPlan.getInfoBranch() != null                    && infoStudentCurricularPlan.getInfoBranch().getName().length() != 0)                session.setAttribute(SessionConstants.INFO_BRANCH, infoStudentCurricularPlan                        .getInfoBranch().getName());            session.setAttribute(SessionConstants.INFO_EXECUTION_YEAR, anoLectivo);            session.setAttribute(SessionConstants.ENROLMENT_LIST, newEnrolmentList);            session.setAttribute(SessionConstants.INFO_FINAL_RESULT, infoFinalResult);            return mapping.findForward("ChooseSuccess");        }        throw new Exception();    }