ICEfaces
  1. ICEfaces
  2. ICE-6866

Specific errors not handled by flow adapters or exception handlers available in SWF environment

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2-EE-GA_P02
    • Fix Version/s: EE-1.8.2.GA_P03
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Spring Web Flow 2.0.6
    • Affects:
      Compatibility/Configuration

      Description

      Problem Statement: During the execution of flows in an ICEfaces/SWF integration - certain errors percolate back to the user instead of being handled by flow adapters or exception handlers available in a SWF environment. This is evident in ACI's support case 10052 as well as any general URL hacking where the flowExecutionId is invalid.

      Support Case 10052: The case states that when the SWF snapshotting feature is disabled (max-execution-snapshots="0") - the browser back button causes an exception that brings a 500 error back to the browser. The exception: "FlowExecutionRestorationFailureException" is thrown when the previous flowExecution is being looked up and is not found inside of the SWF snapshot repository (because there aren't any). The customer would like to be able to handle that exception using Spring WebFlow FlowAdapters (or exception handlers).

      The exception is thrown one line before the SWF exception handling and flow adapting kicks in. I investigated ways to access this code earlier and benefit from the SWF configuration. Unfortunately, without the flow logic being looked up, using a flow specific element like a flowHandlerAdapter or exceptionHandler won't work.

      Solution: Introduce general catch for this exception in Web.xml:

          <error-page>
           <exception-type>javax.servlet.ServletException</exception-type>
           <!--exception-type>
              //note, this is the nested exception, provide specific handling for this in error page.
              org.springframework.webflow.execution.repository.FlowExecutionRestorationFailureException
           </exception-type-->
           <location>/logon.jspx</location>
         </error-page>

      By the time the exception makes it to the browser it has been wrapped as a ServletException. The web.xml change above causes our SWF integration code to fail by a null pinter as the location doesn't carry a flowExecutionId.

      After reviewing this code, a simple try/catch NullPointerException block was wrapped around the existing code. Testing these two elements together provided stable error handling for this scenario.

      try {
          value = RequestContextHolder.getRequestContext()
                   .getFlowExecutionContext().getKey().toString();
          } catch (NullPointerException npe) {
             value = null;
      //this is a sign that there isn't an execution context present, lets still try to show the page without it
      // a prime use case for this are error pages or session timeout pages, etc. They don't require an execution context
          }

        Activity

        Hide
        Tyler Johnson added a comment -

        The customer has said for the mean time, they will set the max-execution-snapshots attribute to a smaller number (ex. 5). If the user clicks the back button more that 5 times, they will display an error page. However, in order to do this they will still need the above code fix.

        Show
        Tyler Johnson added a comment - The customer has said for the mean time, they will set the max-execution-snapshots attribute to a smaller number (ex. 5). If the user clicks the back button more that 5 times, they will display an error page. However, in order to do this they will still need the above code fix.
        Hide
        Ken Fyten added a comment -

        Ted to commit this work-around fix.

        Show
        Ken Fyten added a comment - Ted to commit this work-around fix.
        Hide
        Ted Goddard added a comment -

        Change is as follows:

        — core/src/com/icesoft/util/SeamUtilities.java (revision 24563)
        +++ core/src/com/icesoft/util/SeamUtilities.java (working copy)
        @@ -617,8 +617,13 @@
        flowIdParameterName = "_flowExecutionKey";
        }
        } else if (2 == springLoaded) {

        • value = RequestContextHolder.getRequestContext()
        • .getFlowExecutionContext().getKey().toString();
          + try { + value = RequestContextHolder.getRequestContext() + .getFlowExecutionContext().getKey().toString(); + }

          catch (NullPointerException e)

          { + //SWF is not initialized + value = null; + }

          if (null != value) {
          //Spring Web Flow 2.x confirmed
          flowIdParameterName =

        Show
        Ted Goddard added a comment - Change is as follows: — core/src/com/icesoft/util/SeamUtilities.java (revision 24563) +++ core/src/com/icesoft/util/SeamUtilities.java (working copy) @@ -617,8 +617,13 @@ flowIdParameterName = "_flowExecutionKey"; } } else if (2 == springLoaded) { value = RequestContextHolder.getRequestContext() .getFlowExecutionContext().getKey().toString(); + try { + value = RequestContextHolder.getRequestContext() + .getFlowExecutionContext().getKey().toString(); + } catch (NullPointerException e) { + //SWF is not initialized + value = null; + } if (null != value) { //Spring Web Flow 2.x confirmed flowIdParameterName =
        Hide
        Ken Fyten added a comment -

        Confirmed as working.

        Show
        Ken Fyten added a comment - Confirmed as working.

          People

          • Assignee:
            Ted Goddard
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: