Wooi Joe Chuah [
https://community.jboss.org/people/joe.chuah] created the discussion
"Calling workItemManager.completeWorkItem() on a dynamicSubProcess results in NPE
& root cause"
To view the discussion, visit:
https://community.jboss.org/message/779240#779240
--------------------------------------------------------------
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
[
https://community.jboss.org/message/779240#779240]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]