]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/InstantiationManager.java
FlowNamespace extended (flows in flows, param in arg)
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / InstantiationManager.java
index eb6ce53473407a258fb5f1a6af52401be5201eb8..c3692a55026dffab43ca0dc3dfc6eceff6191c10 100644 (file)
@@ -26,14 +26,14 @@ public class InstantiationManager {
        }\r
 \r
        public void flowInitializationStarted(ExecutionFlow flow, String flowName) {\r
-               if (log.isTraceEnabled())\r
-                       log.trace("Start initialization of " + flow.hashCode() + " ("\r
-                                       + flow + " - " + flow.getClass() + ")");\r
-\r
                // set the flow name if it is DefaultExecutionFlow\r
                if (flow instanceof DefaultExecutionFlow) {\r
                        ((DefaultExecutionFlow) flow).setBeanName(flowName);\r
                }\r
+               \r
+               if (log.isTraceEnabled())\r
+                       log.trace("Start initialization of " + flow.hashCode() + " ("\r
+                                       + flow + " - " + flow.getClass() + ")");\r
 \r
                // log.info("# flowInitializationStarted " + flowName);\r
                // create a stack for this thread if there is none\r
@@ -47,12 +47,19 @@ public class InstantiationManager {
                if (log.isTraceEnabled())\r
                        log.trace("Finish initialization of " + flow.hashCode() + " ("\r
                                        + flow + " - " + flow.getClass() + ")");\r
-               ExecutionFlow registeredFlow = flowStack.get().pop();\r
-               if (registeredFlow != null) {\r
-                       if (!flow.getName().equals(registeredFlow.getName()))\r
-                               throw new SlcException("Current flow is " + flow);\r
-                       // log.info("# flowInitializationFinished " + flowName);\r
-                       // initializingFlow.set(null);\r
+               \r
+               if(flowStack.get() != null) {\r
+                       ExecutionFlow registeredFlow = flowStack.get().pop();\r
+                       if (registeredFlow != null) {\r
+                               if (!flow.getName().equals(registeredFlow.getName()))\r
+                                       throw new SlcException("Current flow is " + flow);\r
+                               // log.info("# flowInitializationFinished " + flowName);\r
+                               // initializingFlow.set(null);\r
+                       }\r
+               }\r
+               else {\r
+                       // happens for flows imported as services\r
+                       log.warn("flowInitializationFinished - Flow Stack is null");\r
                }\r
        }\r
 \r