JBoss Community

Calling workItemManager.completeWorkItem() on a dynamicSubProcess results in NPE & root cause

created by Wooi Joe Chuah in jBPM - View the full discussion

Hi,

 

I've been bugged by this stack trace for a long time now whenever a dynamicSubProcess created by the DynamicUtils is terminated.

 

Caused by: java.lang.NullPointerException

    at org.jbpm.workflow.instance.node.SubProcessNodeInstance.handleOutMappings(SubProcessNodeInstance.java:192)

    at org.jbpm.workflow.instance.node.SubProcessNodeInstance.processInstanceCompleted(SubProcessNodeInstance.java:185)

    at org.jbpm.workflow.instance.node.SubProcessNodeInstance.signalEvent(SubProcessNodeInstance.java:173)

    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:344)

    at org.jbpm.process.instance.event.DefaultSignalManager.internalSignalEvent(DefaultSignalManager.java:81)

    at org.jbpm.process.instance.event.DefaultSignalManager$SignalAction.execute(DefaultSignalManager.java:181)

    at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:976)

    ... 96 more

 

After tracing the code, I've found the root cause which is located at org.jbpm.workflow.core.node.SubProcessNode

public List<DataAssociation> getOutAssociations() {

    return Collections.unmodifiableList(this.outMapping); }

 

the outMapping attribute of the dynamicSubProcess is null hence calling Collections.unmodifiableList(null) will hit a NPE.

 

Since SubProcessNodeInstance.java:192 (handleOutMappings) expects a Collection object to be returned, I suggest returning an empty list if the outMapping is null.

 

If anyone would be so helpful to implement a fix for this I'd be very greatful :) no more ugly stacktraces after completing the process.

 

Thanks

Reply to this message by going to Community

Start a new discussion in jBPM at Community