Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-1144

NPE in FlowHandlerAdapter.sendFlowDefinitionRedirect when flowRedirect does not have parameters appended to it

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.7
    • Fix Version/s: 2.0.8
    • Component/s: Core: Flow Executor
    • Labels:
      None

      Description

      When defining a flowRedirect without a ? appended to it, a NPE is thrown at FlowHandlerAdapter.sendFlowDefinitionRedirect as the input map from context.getFlowRedirectFlowInput() is null.

      For example, defining a <view-state id="test" view="flowRedirect:other-test"/>, this NPE will be encountered.

      So far, what I can find is that when there is no ? appended to the end of the flowRedirect:<flow>, the input map is not created. The corresponding code in the FlowDefinitionRedirectAction.doExecute is

      int index = encodedRedirect.indexOf('?');
      String flowDefinitionId;
      LocalAttributeMap executionInput = null;
      if (index != -1) {
      flowDefinitionId = encodedRedirect.substring(0, index);
      String[] parameters = StringUtils.delimitedListToStringArray(encodedRedirect.substring(index + 1), "&");
      executionInput = new LocalAttributeMap(parameters.length, 1);
      for (int i = 0; i < parameters.length; i++) {
      String nameAndValue = parameters[i];
      index = nameAndValue.indexOf('=');
      if (index != -1)

      { executionInput.put(nameAndValue.substring(0, index), nameAndValue.substring(index + 1)); }

      else

      { executionInput.put(nameAndValue, ""); }

      }
      } else {
      flowDefinitionId = encodedRedirect;
      }

      executionInputMap is only created if there is a ? in the flow redirect. If it does not exist, the map continues to remain null, whilst the flowRedirect action is created.

        Attachments

          Activity

            People

            Assignee:
            jeremyg484 Jeremy Grelle
            Reporter:
            kodarc Jegadisan S/O Sankar Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: