You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Bill Lucy <wt...@gmail.com> on 2016/04/22 20:14:45 UTC

Flow ID Ambiguity

I've run in to an interesting scenario with the flow handling logic.  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."}}

Would it be helpful for us to emit some kind of similar warning/error in
this case?  Or do we want to keep the current behavior?

Thanks,
Bill Lucy

Re: Flow ID Ambiguity

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

It is a good idea to add a warning/error in that case. Please create an
issue in the issue tracker, so we can include the suggestion.

regards,

Leonardo

2016-04-22 13:14 GMT-05:00 Bill Lucy <wt...@gmail.com>:

> I've run in to an interesting scenario with the flow handling logic.  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."}}
>
> Would it be helpful for us to emit some kind of similar warning/error in
> this case?  Or do we want to keep the current behavior?
>
> Thanks,
> Bill Lucy
>