NullPointerException in CleanupWorkflowOperationHandler

Steps to reproduce

Steps to reproduce:
1. Run a workflow with a 'cleanup' operation *not* in the last place.
2.
3.

Actual Results:
The operation fails with a NullPointerException

Expected Results:
The operation should succeed

Workaround (if any):

Activity

Show:
Rubén Pérez
June 28, 2017, 10:02 AM
Edited

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.

Rubén Pérez
August 23, 2017, 12:09 PM

Hi,

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.

Fixed and reviewed

Assignee

Rubén Pérez

Reporter

Rubén Pérez

Severity

Crash/Hang

Tags (folksonomy)

None

Components

Fix versions

Affects versions

Priority

Major