Completing a task in DelegationState.PENDING does not throw ActivitiException

Description

TaskService documentation for method

void complete(String taskId)

says it throws ActivitiException - when this task is DelegationState.PENDING delegation. But the code below does not see such exception.

//Start some process
Map<String, Object> variables = new Map<String, Object>();
String processId = runtimeService.startProcessInstanceByKey(('myProcess', variables);
Task task = taskService.createTaskQuery().processInstanceId(processId).singleResult();
taskService.setOwner(task.getId(), "my-brother");
taskService.setAssignee(task.getId(), "my-brother");
taskService.delegateTask(task.getId(), "my-housekeeper"); //Task is in DelegationState.PENDING state after this.
taskService.complete(task.getId()); //According to documentation ActivitiException should be thrown. But not!

Please clarify whether this is implementation bug or documentation bug? Either way, one of them has to be fixed.

Environment

None

Assignee

Joram Barrez

Reporter

Ravi Hegde

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure