Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4044

Flow ID Ambiguity Is Not Handled Well

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.9
    • 2.2.10
    • None
    • None

    Description

      If we have multiple flows with the same IDs and definingDocumentIds, we won't behave as expected: only one flow will actually be used, but no error or warning to that effect is emitted.

      Consider if we have two apps in the same EAR, each defining flows with an ID of "sample-flow", like this:

      final String flowId = "sample-flow";
      flowBuilder.id("", flowId);

      Per the JSF spec, this creates ambiguity:

      11.4.3.1
      Defining Flows
      Flows are defined using the <flow-definition> element. This element must have an id attribute which uniquely
      identifies the flow within the scope of the Application Configuration Resource file in which the element appears. To
      enable multiple flows with the same id to exist in an application, the <faces-config><name> element is taken to
      be the definingDocumentId of the flow. If no <name> element is specified, the empty string is taken as the value
      for definingDocumentId.

      In this case, app1 might define some kind of initializer with the flow, while app2 doesn't. In that case, app2 might (incorrectly) end up trying to use an initializer that was intended for app1. A developer might see issues resulting from the initializer being called from the wrong app, but it wouldn't be clear that the wrong flow had been entered (due to ambiguity).

      Mojarra has something like this:
      Caused by: java.lang.IllegalStateException: Flow with id \"sample-flow\" and definingDocumentId \"\" already exists."}}

      I think that MyFaces should emit some kind of similar warning/error in the given scenario.

      Attachments

        1. MYFACES-4044.patch
          1 kB
          Bill Lucy

        Activity

          People

            wtlucy Bill Lucy
            wtlucy Bill Lucy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: