Source:
<code>public ActionForward enrolInOptionalCurricularCourse(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { final BolonhaStudentOptionalEnrollmentBean optionalStudentEnrollmentBean = getBolonhaStudentOptionalEnrollmentBeanFromViewState(); try { final RuleResult ruleResults = EnrolBolonhaStudent.run(optionalStudentEnrollmentBean.getStudentCurricularPlan(), optionalStudentEnrollmentBean.getExecutionPeriod(), buildOptionalDegreeModuleToEnrolList(optionalStudentEnrollmentBean), Collections.<CurriculumModule> emptyList(), getCurricularRuleLevel(form)); if (ruleResults.isWarning()) { addRuleResultMessagesToActionMessages("warning", request, ruleResults); } } catch (EnrollmentDomainException ex) { addRuleResultMessagesToActionMessages("error", request, ex.getFalseResult()); request.setAttribute("optionalEnrolmentBean", optionalStudentEnrollmentBean); return mapping.findForward("chooseOptionalCurricularCourseToEnrol"); } catch (DomainException ex) { addActionMessage("error", request, ex.getKey(), ex.getArgs()); request.setAttribute("optionalEnrolmentBean", optionalStudentEnrollmentBean); return mapping.findForward("chooseOptionalCurricularCourseToEnrol"); <START> } catch (org.fenixedu.bennu.core.domain.exceptions.DomainException de) { <END> addActionMessage("error", request, de.getLocalizedMessage(), false); request.setAttribute("optionalEnrolmentBean", optionalStudentEnrollmentBean); return mapping.findForward("chooseOptionalCurricularCourseToEnrol"); } return prepareShowDegreeModulesToEnrol(mapping, form, request, response, optionalStudentEnrollmentBean.getStudentCurricularPlan(), optionalStudentEnrollmentBean.getExecutionPeriod()); }</code><technical_language>other place in this class a DomainException is replaced this type</technical_language>

Target:
public ActionForward enrolInOptionalCurricularCourse(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { final BolonhaStudentOptionalEnrollmentBean optionalStudentEnrollmentBean = getBolonhaStudentOptionalEnrollmentBeanFromViewState(); try { final RuleResult ruleResults = EnrolBolonhaStudent.run(optionalStudentEnrollmentBean.getStudentCurricularPlan(), optionalStudentEnrollmentBean.getExecutionPeriod(), buildOptionalDegreeModuleToEnrolList(optionalStudentEnrollmentBean), Collections.<CurriculumModule> emptyList(), getCurricularRuleLevel(form)); if (ruleResults.isWarning()) { addRuleResultMessagesToActionMessages("warning", request, ruleResults); } } catch (EnrollmentDomainException ex) { addRuleResultMessagesToActionMessages("error", request, ex.getFalseResult()); request.setAttribute("optionalEnrolmentBean", optionalStudentEnrollmentBean); return mapping.findForward("chooseOptionalCurricularCourseToEnrol"); } catch (DomainException de) { addActionMessage("error", request, de.getLocalizedMessage(), false); request.setAttribute("optionalEnrolmentBean", optionalStudentEnrollmentBean); return mapping.findForward("chooseOptionalCurricularCourseToEnrol"); } StudentCurricularPlan scp = getActiveRegistration(optionalStudentEnrollmentBean.getStudentCurricularPlan()); return prepareShowDegreeModulesToEnrol(mapping, form, request, response, scp, optionalStudentEnrollmentBean.getExecutionPeriod()); }