You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/11/20 04:06:45 UTC

svn commit: r1543701 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java

Author: lu4242
Date: Wed Nov 20 03:06:43 2013
New Revision: 1543701

URL: http://svn.apache.org/r1543701
Log:
MYFACES-3824 - @FlowScope with no defining documentId set cannot found active flow with explicit documentId

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java?rev=1543701&r1=1543700&r2=1543701&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopedContextImpl.java Wed Nov 20 03:06:43 2013
@@ -264,8 +264,18 @@ public class FlowScopedContextImpl imple
                     " cannot be found when resolving bean " + bean.toString());
             }
             
-            if (!facesContext.getApplication().getFlowHandler().isActive(facesContext, 
-                    reference.getDocumentId() == null ? "" : reference.getDocumentId(), reference.getId()))
+            FlowHandler flowHandler = facesContext.getApplication().getFlowHandler();
+            // Since it is possible to have only the flow id without documentId, the best
+            // is first get the flow using flowHandler.getFlow and then check if the flow is
+            // active or not, but using the documentId and id of the retrieved flow.
+            Flow flow = flowHandler.getFlow(facesContext, 
+                reference.getDocumentId() == null ? "" : reference.getDocumentId(), reference.getId());
+            if (flow == null)
+            {
+                throw new IllegalStateException(bean.toString() + "cannot be created because flow "+ reference.getId()+
+                    " is not registered");
+            }
+            if (!flowHandler.isActive(facesContext, flow.getDefiningDocumentId(), flow.getId())) 
             {
                 throw new IllegalStateException(bean.toString() + "cannot be created if flow "+ reference.getId()+
                     " is not active");