[ http://jira.andromda.org/browse/BPM-245?page=comments#action_11970 ] Bobby Peterson commented on BPM-245: ------------------------------------
>From the code that was generated in the 3.0 example above it looks like it was >pretty explicit to be a bug but if you say that's what it was I guess I have >to believe you. But I like the way it worked when it was a bug. In the current way, to have multiple errors displayed I need to save them all and then find the last place in my code before the generated code is going to make the next method call and throw an exception, (but I don't want the exception to be displayed as an because it is just there because it is now required.) > saveErrorMessages don't work anymore > ------------------------------------ > > Key: BPM-245 > URL: http://jira.andromda.org/browse/BPM-245 > Project: Bpm4Struts Cartridge > Type: Bug > Versions: 3.1M1 > Environment: JDK 1.5, Struts 1.2.7, Windows XP Pro > Reporter: Bobby Peterson > Assignee: Wouter Zoons > Priority: Critical > > After upgrading to 3.1 I have had many problems with the error messages and > validation. The custom validation is still not working. In the controller > methods I call saveErrorMessage given it the request and a valid message key. > The error is saved into the session but the flow of the application > continues to go to the next action state, JSP which causes major problems > because an error has occured. > With some investigation I found that the code generated in 3.0 wrapped the > next call in an if block like the following: > if (this.errorsNotPresent(request)) > { > forward = _retrieveData(mapping, form, request, response); > } > in 3.1 the code looks like: > forward = _retrieveData(mapping, form, request, response); > Is there a reason this change was made? Did I not set a property? If so, > shouldn't the old behavior be the default? > Thanks for the help or the fix. > The complete methods are below: > ############################################### 3.0 > ########################################### > ActionForward forward = null; > private ActionForward _detailsOk(ActionMapping mapping, ActionForm form, > HttpServletRequest request, HttpServletResponse response) throws Exception > { > ActionForward forward = null; > final org.apache.struts.action.ActionMessages errors = > this.getExceptionHandlerErrors(request); > try > { > if (this.errorsNotPresent(request)) > { > > PlanControllerFactory.getPlanControllerInstance().saveDetails(mapping, > DetailsSummarySaveDetailsFormImpl)form, request, response); > } > if (this.errorsNotPresent(request)) > { > forward = _retrieveData(mapping, form, request, response); > } > } > catch (Exception ex) > { > final String messageKey = > org.andromda.presentation.bpm4struts.PatternMatchingExceptionHandler.instance().handleException(ex); > > errors.add(org.apache.struts.action.ActionMessages.GLOBAL_MESSAGE, new > org.apache.struts.action.ActionMessage(messageKey)); > } > finally > { > } > if (!errors.isEmpty()) > { > forward = mapping.getInputForward(); > } > return forward; > } > ###################################### 3.1 > ######################################################### > private org.apache.struts.action.ActionForward > _detailsOk(org.apache.struts.action.ActionMapping mapping, > org.apache.struts.action.ActionForm form, > javax.servlet.http.HttpServletRequest request, > javax.servlet.http.HttpServletResponse response) throws java.lang.Exception > { > org.apache.struts.action.ActionForward forward = null; > try > { > > com.sys.uswdss.web.planning.plan.PlanControllerFactory.getPlanControllerInstance().saveDetails(mapping, > (DetailsSummarySaveDetailsFormImpl)form, request, response); > forward = _retrieveData(mapping, form, request, response); > } > catch (java.lang.Exception exception) > { > final java.lang.String messageKey = > org.andromda.presentation.bpm4struts.PatternMatchingExceptionHandler.instance().handleException(exception); > > com.sys.uswdss.web.planning.plan.PlanControllerFactory.getPlanControllerInstance().saveErrorMessage(request, > messageKey); > throw exception; > } > return forward; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.andromda.org/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf