instance.signal() java.lang.NullPointerException
shijimeng Nov 17, 2005 8:51 PMProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("leave.par/processdefinition.xml"); // Create an instance of the process definition. ProcessInstance instance = new ProcessInstance(processDefinition); Map map = new HashMap(); map.put("quantity","3"); instance.getContextInstance().addVariables(map); // Move the process instance from its start state to the first state. // The configured action should execute and the appropriate message // should appear in the message process variable. System.out.println( "Instance is in ((start)) state: "+ instance.getRootToken().getNode().getName()); instance.signal(); System.out.println( "Instance is in ((manager audit)) state: "+ instance.getRootToken().getNode().getName()); instance.signal("audit_nopass_end"); System.out.println( "Instance is in ((end)) state: "+ instance.getRootToken().getNode().getName());
processdefinition.xml
<start-state name="start"> <task> <controller> <variable name="item" /> <variable name="quantity" /> <variable name="address" /> </controller> </task> <transition name="manager_aduit_trans" to="manager audit"></transition> </start-state> <task-node name="manager audit"> <task> <controller> <variable name="item" access="read" /> <variable name="quantity" access="read" /> <variable name="address" access="read" /> <variable name="comment" /> </controller> <timer duedate="20 seconds" repeat="10 seconds"> <action name="class" class="com.bpm.oa.leave.ManagerAudit"> </action> </timer> </task> <transition name="audit_nopass_end" to="end"></transition> <transition name="audit_pass_route" to="manager audit route"></transition> <event type="node-enter"> <action name="class" class="com.bpm.oa.leave.ManagerAudit"></action> </event> <event type="node-leave"> <action name="class" class="com.bpm.oa.leave.ManagerAudit"></action> </event> </task-node> ...........
if it exists in <task-node> ,this unittest happen a java.lang.NullPointerException in instance.signal().
if it doesn't exist ,this unittest happen a Exception in instance.signal("audit_nopass_end").
the output is Instance is in ((manager audit)) state: end;