Uploaded image for project: 'Hippo Site Toolkit 2'
  1. Hippo Site Toolkit 2
  2. HSTTWO-4638

Advanced exception handling not working anymore

    XMLWordPrintable

    Details

    • Similar issues:
    • Flagged:
      Flagged

      Description

      We are using the addvanced exception handling as described here: https://documentation.bloomreach.com/library/concepts/error-pages-and-error-handling/4.-advanced-exception-handling.html

      This does now lead to a blank white page, if the code is called.

      You may use the following simple handler, to reproduce the error.

      class CustomPageErrorHandler : PageErrorHandler {
          override fun handleComponentExceptions(pageErrors: PageErrors, request: HstRequest, response: HstResponse): Status {
              response.forward("/page-technical-error")
              return Status.HANDLED_TO_STOP
          }
      } 

      I have debugged and found that the value set with request.forward is not processed anymore.

      Looking into org.hippoecm.hst.core.container.AggregationValve (of version 13.2.1) you will find the following block starting at line 169

      // check if it's requested to forward.
      final String forwardPathInfo = rootWindow.getResponseState().getForwardPathInfo();
      
      // page error handling...
      PageErrors pageErrors = getPageErrors(sortedComponentWindows, true);
      
      if (pageErrors != null) {
          PageErrorHandler.Status handled = handleComponentExceptions(pageErrors, requestContainerConfig, rootWindow, requestMap.get(rootWindow), responseMap.get(rootWindow));
      
          // page error handler should be able to override redirect location or forward path info.
          if (rootWindow.getResponseState().getRedirectLocation() != null) {
              redirectLocation = rootWindow.getResponseState().getRedirectLocation();
          }
      
          if (handled == PageErrorHandler.Status.HANDLED_TO_STOP && redirectLocation == null && forwardPathInfo == null) {
              context.invokeNext();
              return;
          }
      }

      The forwardPathInfo is read prior to handleComponentExceptions() which sets this path using request.forward()

      Looking into the GIT history of this file I found the following commit https://code.onehippo.org/cms-community/hippo-site-toolkit/commit/6ff4a93fcec40dabef1b9766ca5ec88213e264e6 where the relevant lines have been removed:

      if (rootWindow.getResponseState().getForwardPathInfo() != null) {
          forwardPathInfo = rootWindow.getResponseState().getForwardPathInfo();
      } 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mmilicevic Marijan Milicevic
                Owner:
                Hippo Helpdesk
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: