Actually, NPE is in my code, not in SWF. I experiment whit this before some time and remember it wrong. I apologies for that, I really should look at it more closely before posting :oops:
Nevertheless, problem still exists. I encounter it when view id in end state is not set. In that situation FlowExecution.start(Event) method returns null and I was not able to retrieve model from it which results in NPE (in my code). Everything works fine if I set view attribute of end state to any value (i.e "dummy"). Here is a sample code.
Code:
public class FlowTester {
public static void main(final String[] p_args) {
ApplicationContext context =
new ClassPathXmlApplicationContext("swftesting/applicationConfig.xml");
Flow flow = (Flow)context.getBean("sampleFlow");
FlowExecution flowExecution = new FlowExecutionImpl(flow);
Map eventParams = new HashMap();
eventParams.put("FlowInput:paramOne", "FlowInput:paramOne - flow input");
Event startEvent = new Event(new Object(), "startEvent", eventParams);
ViewDescriptor viewDescriptor = flowExecution.start(startEvent);
Map model = viewDescriptor.getModel();
System.out.println("In FlowTester");
System.out.println(" " + model.get("SampleActionOne:myParamOne"));
}
}
With some further investigation, I noted that in EndState class view descriptor is set to null if EndState.isMarker() method returns true. When I chage it to "viewDescriptor = new ViewDescriptor(null, context.getModel());"
everything works fine. At first look it seams to me that model should be exposed via ViewDescriptor even if view id is not set in end state. Am I wrong?
Damir Murat