Steps to reproduce:
1. Run a workflow with a 'cleanup' operation *not* in the last place.
The operation fails with a NullPointerException
The operation should succeed
Workaround (if any):
The operation fails because it now tries to delete the job arguments of all the operations that run in the workflow. The problem is, it does not actually filter the operations that have not run yet, namely the 'cleanup' operation itself or any other that may come later. For those operations that did not run yet, the method WorkflowOperationInstance.getId() may return null if the operation has not run yet, which causes a NullPointerException in the code.
Note that this surfaces a clear design problem: cleanup was primarily designed to clean the workspace, not the database. Should the jobArguments be a problem, then the WorkflowService itself (and not a simple operation) should take care of cleaning the jobArguments after the workflow has successfully run. Such a refactoring is, however, out of the scope of this ticket.
A solution to this issue was already merged in the codebase, but because it happened during the Github test, apparently the issue was not automatically closed.
I'm doing it now, and I'm adapting the "fix version" part, because this has been fixed since, at least 3.1.