String stringGrade = ie.getInfoEnrolmentEvaluation().getGrade();
String stringGrade; if (ie.getInfoEnrolmentEvaluation()!=null) {  stringGrade = ie.getInfoEnrolmentEvaluation().getGrade(); } else { stringGrade="NA"; }
    public ActionForward prepare(        ActionMapping mapping,        ActionForm form,        HttpServletRequest request,        HttpServletResponse response)        throws FenixActionException    {        HttpSession session = this.getSession(request);        IUserView userView = (IUserView) session.getAttribute(SessionConstants.U_VIEW);        List candidacies = null;        ActionForward destiny = null;        List candidaciesExtendedInfo = new LinkedList();        InfoClassification ic = null;        String seminaryIDString = request.getParameter("seminaryID");        Integer seminaryID = null;        Integer wildcard = new Integer(-1);        List seminaries = null;        try        {            seminaryID = new Integer(seminaryIDString);        } catch (NumberFormatException ex)        {            seminaryID = wildcard;        }        try        {            Object[] argsReadSeminaries = { new Boolean(false)};            Object[] argsReadCandidacies =                {                    wildcard,                    seminaryID,                    wildcard,                    wildcard,                    wildcard,                    wildcard,                    wildcard,                    wildcard,                    wildcard,                    wildcard,                    null };            seminaries =                (List) ServiceManagerServiceFactory.executeService(                    userView,                    "Seminaries.GetAllSeminaries",                    argsReadSeminaries);            candidacies =                (List) ServiceManagerServiceFactory.executeService(                    userView,                    "Seminaries.ReadCandidacies",                    argsReadCandidacies);            for (Iterator iterator = candidacies.iterator(); iterator.hasNext();)            {                InfoStudent student = null;                InfoStudentCurricularPlan studentCurricularPlan = null;                InfoCandidacy candidacy = (InfoCandidacy) iterator.next();                Object[] argsReadStudent = { candidacy.getStudentIdInternal()};                student =                    (InfoStudent) ServiceManagerServiceFactory.executeService(                        userView,                        "student.ReadStudentById",                        argsReadStudent);                Object[] argsReadCurricularPlan = { student.getNumber(), student.getDegreeType()};                studentCurricularPlan =                    (InfoStudentCurricularPlan) ServiceManagerServiceFactory.executeService(                        userView,                        "student.ReadActiveStudentCurricularPlanByNumberAndDegreeType",                        argsReadCurricularPlan);                //                //                //                Object argsReadStudentCurricularPlans[] =                    { new UserView(student.getInfoPerson().getUsername(), new LinkedList())};                InfoStudentCurricularPlan selectedSCP = null;                List cps =                    (ArrayList) ServiceManagerServiceFactory.executeService(                        userView,                        "ReadStudentCurricularPlansForSeminaries",                        argsReadStudentCurricularPlans);                long startDate = Long.MAX_VALUE;                for (Iterator iter = cps.iterator(); iter.hasNext();)                {                    InfoStudentCurricularPlan cp = (InfoStudentCurricularPlan) iter.next();                    if (cp.getStartDate().getTime() < startDate)                    {                        startDate = cp.getStartDate().getTime();                        selectedSCP = cp;                    }                }                Object getCurriculumArgs[] = { null, selectedSCP.getIdInternal()};                List enrollments =                    (ArrayList) ServiceManagerServiceFactory.executeService(                        userView,                        "ReadStudentCurriculum",                        getCurriculumArgs);                //                //                ic = new InfoClassification();                int i = 0;                float acc = 0;                float grade = 0;                for (Iterator iter = enrollments.iterator(); iter.hasNext();)                {                    InfoEnrolment ie = (InfoEnrolment) iter.next();                    String stringGrade = ie.getInfoEnrolmentEvaluation().getGrade();                    if (stringGrade != null && !stringGrade.equals("RE") && !stringGrade.equals("NA"))                    {                        Float gradeObject = new Float(stringGrade);                        grade = gradeObject.floatValue();                        acc += grade;                        i++;                    }                }                if (i != 0)                {                    String value = new DecimalFormat("#0.0").format(acc / i);                    ic.setAritmeticClassification(value);                }                ic.setCompletedCourses(new Integer(i).toString());                //				                //                  InfoCandidacyDetails infoCandidacyDetails = new InfoCandidacyDetails();                infoCandidacyDetails.setIdInternal(candidacy.getIdInternal());                infoCandidacyDetails.setInfoClassification(ic);                infoCandidacyDetails.setStudent(student);                if (candidacy.getApproved() == null)                    candidacy.setApproved(new Boolean(false));                infoCandidacyDetails.setApproved(candidacy.getApproved());                infoCandidacyDetails.setMotivation(candidacy.getMotivation());                candidaciesExtendedInfo.add(infoCandidacyDetails);            }        } catch (Exception e)        {            throw new FenixActionException();        }        request.setAttribute("seminaries", seminaries);        request.setAttribute("candidacies", candidaciesExtendedInfo);        destiny = mapping.findForward("showSelectCandidacies");        return destiny;    }