cancel
Showing results for 
Search instead for 
Did you mean: 

Java backed webscript, retrieving package items by task id throws null pointer exception

sihnu
Champ in-the-making
Champ in-the-making
Hi,

I'm looping through completed workflows. I do tasks search retrieving all the tasks of the workflow instance. I parse the tasks and then try to search all the package items of the task and I get null noderef exception. I can see the nodeRef in log and I have tried to find the node using node browser and it looks like the node doesn't exist. Why does the workflowservice try to search a node that doesn't exist?

Here is my code:

List<WorkflowInstance> instances = this.workflowService.getCompletedWorkflows();
for (WorkflowInstance instance : instances) {
  WorkflowTaskQuery query = new WorkflowTaskQuery();
  query.setActive(false);
  query.setTaskState(null);
  query.setProcessId(instance.getId());
  List<WorkflowTask> tasks = workflowService.queryAllTasks(query);
  WorkflowTask endTask = getEndTask(tasks); // I needed to my own parsing here because when I tried to do the query with custom properties I always got empty list
  if (endTask != null) {
    List<NodeRef> items = this.workflowService.getPackageContents(endTask.getId()); // HERE THE ERROR OCCURS!!!
    …
  }
}


Any help would be greatly appreciated.
1 REPLY 1

sihnu
Champ in-the-making
Champ in-the-making
Could it be that workflow service is trying to retrieve nodes that have been deleted from the repository and once belonged to the workflow? That means they are not synced correctly if they are synced at all.