Bpm4Struts Cartridge

saveErrorMessages don't work anymore

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Not an issue
  • Affects Version/s: 3.1M1
  • Fix Version/s: None
  • Component/s: None
  • Description:
    Hide
    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;
        }

    Show
    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;     }
  • Environment:
    JDK 1.5, Struts 1.2.7, Windows XP Pro

Activity

Wouter Zoons made changes - 16/Aug/05 6:10 PM
Field Original Value New Value
Status Open [ 1 ] In Progress [ 3 ]
Wouter Zoons made changes - 17/Aug/05 9:32 PM
Status In Progress [ 3 ] Open [ 1 ]
Wouter Zoons made changes - 19/Aug/05 6:58 AM
Status Open [ 1 ] Closed [ 6 ]
Resolution Not an issue [ 6 ]

People

Dates

  • Created:
    16/Aug/05 5:30 PM
    Updated:
    19/Aug/05 6:58 AM
    Resolved:
    19/Aug/05 6:58 AM