cancel
Showing results for 
Search instead for 
Did you mean: 

Task Assignment question.,

sathish1
Champ in-the-making
Champ in-the-making
It is Friday evening and am hoping noone should answer this issue or question.,

But brief overview with this issue., am trying to do some work related to task assignments. Logging in as a super-user and trying to assign tasks to few users who will be in the system. Authentication is done external of activiti and am assuming this issue is not related,

Currently in the code am doing this


    public void reAssignTasks(String[] tasks, String inboxOfUserSelected, String assignedToUser) throws ActivitiException {
        TaskQuery taskQuery = taskService.createTaskQuery();
        try {
            for (String taskid : tasks) {
                Task task = taskQuery.taskId(taskid).singleResult();
                task.setAssignee(assignedToUser);
                taskService.saveTask(task);
            }
        } catch (Exception excep) {
            log.error("Error raised when reassigning tasks in ExplorerTaskServiceImpl reAssignTasks", excep.fillInStackTrace());
            throw new ActivitiException(excep.toString());
        }
    }


everything works well, yeah I know am catching the Exception object it is wrong, please ignore that.
But during this code excecution sometime I hit a scenario where the IdentityLink.getUser method is null. Any tghts on what other information I can provide to make this question better and how to go about resolving this issue. Please see screen for where it is throwing an exception.

justpaste.it/gk1l
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
In case you have processes with candidateGroups defined, the userId will be null. Make sure you check that, before comparing. Or - better programming practice - switch the .equals() clauses, calling the .equals() on the object you're sure of never being null (userId), inseatd of the other way around.