-
Bug
-
Resolution: Done
-
Major
-
jBPM 4.3
Process execution terminates with NullPointerException, when there is task with candidate-groups after join node in process definition.
Example test case:
process.jpdl.xml
<?xml version="1.0" encoding="UTF-8"?>
<process name="TaskAfterJoinTest" xmlns="http://jbpm.org/4.3/jpdl">
<start g="16,60,48,48">
<transition to="fork"/>
</start>
<fork g="96,60,48,48" name="fork">
<transition g="120,41:" to="state1"/>
<transition to="state2" g="120,126:"/>
</fork>
<state g="176,16,149,52" name="state1">
<transition g="379,40:" to="join"/>
</state>
<state g="176,100,149,52" name="state2">
<transition to="join" g="382,125:"/>
</state>
<join g="357,60,48,48" name="join">
<transition to="task1"/>
</join>
<end g="561,60,48,48" name="end"/>
<task candidate-groups="sales-dept" g="437,58,92,52" name="task1">
<transition to="end"/>
</task>
</process>
TaskAfterJoinTest.java
public class TaskAfterJoinTest extends JbpmTestCase {
String deploymentId;
protected void setUp() throws Exception
{ super.setUp(); deploymentId = repositoryService.createDeployment() .addResourceFromClasspath("process.jpdl.xml") .deploy(); }protected void tearDown() throws Exception
{ repositoryService.deleteDeploymentCascade(deploymentId); super.tearDown(); }public void test()
{ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskAfterJoinTest"); String pid = processInstance.getId(); Set<String> expectedActivityNames = new HashSet<String>(); expectedActivityNames.add("state1"); expectedActivityNames.add("state2"); assertEquals(expectedActivityNames, processInstance.findActiveActivityNames()); assertNotNull(processInstance.findActiveExecutionIn("state1")); assertNotNull(processInstance.findActiveExecutionIn("state2")); String state1Id = processInstance.findActiveExecutionIn("state1").getId(); processInstance = executionService.signalExecutionById(state1Id); expectedActivityNames.remove("state1"); assertEquals(expectedActivityNames, processInstance.findActiveActivityNames()); assertNotNull(processInstance.findActiveExecutionIn("state2")); String state2Id = processInstance.findActiveExecutionIn("state2").getId(); // HERE - it raises NullPointerException processInstance = executionService.signalExecutionById(state2Id); expectedActivityNames.remove("state1"); expectedActivityNames.remove("task1"); assertEquals(expectedActivityNames, processInstance.findActiveActivityNames()); assertNotNull(processInstance.findActiveExecutionIn("task1")); String task1Id = processInstance.findActiveExecutionIn("task1").getId(); processInstance = executionService.signalExecutionById(task1Id); assertNull("execution "+pid+" should not exist", executionService.findExecutionById(pid)); }stack trace:
java.lang.NullPointerException
at org.jbpm.pvm.internal.wire.usercode.UserCodeReference.getProcessDefinition(UserCodeReference.java:75)
at org.jbpm.pvm.internal.wire.usercode.UserCodeReference.getObject(UserCodeReference.java:60)
at org.jbpm.pvm.internal.wire.usercode.UserCodeReference.getObject(UserCodeReference.java:51)
at org.jbpm.pvm.internal.model.ExecutionImpl.initializeAssignments(ExecutionImpl.java:759)
at org.jbpm.jpdl.internal.activity.TaskActivity.execute(TaskActivity.java:95)
at org.jbpm.jpdl.internal.activity.TaskActivity.execute(TaskActivity.java:58)
at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:656)
at org.jbpm.pvm.internal.model.ExecutionImpl.fire(ExecutionImpl.java:566)
at org.jbpm.pvm.internal.model.ExecutionImpl.take(ExecutionImpl.java:472)
at org.jbpm.jpdl.internal.activity.JoinActivity.execute(JoinActivity.java:93)
at org.jbpm.jpdl.internal.activity.JoinActivity.execute(JoinActivity.java:49)
at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:656)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:616)
at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:417)
at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:61)
at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:35)
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:84)
at TaskAfterJoinTest.test(TaskAfterJoinTest.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
- duplicates
-
JBPM-2758 NPE on assignmenthandler when using fork/join
- Resolved