After updating activiti from 5.9 -> 5.11 one of our test cases stopped working:
There is a UserTask which ends in a gateway which in turn triggers a ServiceTask, and within that ServiceTask we call activitiRuntimeService.deleteProcessInstance(…).
While this has worked fine in 5.9 it fails with a NullPointerException in 5.11. If I fix the NPE's (there are two of them):
Index: activiti-5.11/modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java
===================================================================
— activiti-5.11/modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java (Revision 2937)
+++ activiti-5.11/modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java (Arbeitskopie)
@@ -51,7 +51,11 @@
}
protected boolean hasCompensationHandler(ActivityExecution execution) {
- return execution.getActivity().getProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID) != null;
+ if (execution.getActivity() == null) {
+ return false;
+ } else {
+ return execution.getActivity().getProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID) != null;
+ }
}
protected void createCompensateEventSubscription(ActivityExecution execution) {
Index: activiti-5.11/modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/BpmnActivityBehavior.java
===================================================================
— activiti-5.11/modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/BpmnActivityBehavior.java (Revision 2937)
+++ activiti-5.11/modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/BpmnActivityBehavior.java (Arbeitskopie)
@@ -84,6 +84,9 @@
log.fine("Leaving activity '" + execution.getActivity().getId() + "'");
}
+ if (execution.getActivity() == null) {
+ return;
+ }
String defaultSequenceFlow = (String) execution.getActivity().getProperty("default");
List<PvmTransition> transitionsToTake = new ArrayList<PvmTransition>();
the use case works again.
But I fear that I have opened another can of worms.
What is the suggested approach in such a case (I have tried to use activiti:async="true", but to no avail)?
TIA, Heinz-Dieter