myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Lucy <wtl...@gmail.com>
Subject Flow ID Ambiguity
Date Fri, 22 Apr 2016 18:14:45 GMT
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

Mime
View raw message