cancel
Showing results for 
Search instead for 
Did you mean: 

Error while getting identity links

partizano
Champ in-the-making
Champ in-the-making
Hi!

I have process like this:
[attachment=0]MyProcess2211.png[/attachment]

UserTask has the following taskListener on "create" event:
public class CreateTaskListener implements TaskListener {

   private static ProcessEngine processEngine = ActivitiEngine.getInstance();
   private static final Logger log = Logger.getLogger(CreateTaskListener.class.toString());

   public void notify(DelegateTask task) {
      List<String> taskGroups = new ArrayList<String>();
      List<IdentityLink> identityLinks = processEngine.getTaskService().getIdentityLinksForTask(task.getId());
      for (IdentityLink identityLink : identityLinks) {
         if (identityLink.getType().equals(IdentityLinkType.CANDIDATE)) {
            taskGroups.add(identityLink.getGroupId());
         }
      }
      log.info(identityLinks.size());
   }
}

After process is started the following error occurs:
22.11.2011 11:15:01 org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
java.lang.NullPointerException
   at org.activiti.engine.impl.cmd.GetIdentityLinksForTaskCmd.execute(GetIdentityLinksForTaskCmd.java:46)
   at org.activiti.engine.impl.cmd.GetIdentityLinksForTaskCmd.execute(GetIdentityLinksForTaskCmd.java:30)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.TaskServiceImpl.getIdentityLinksForTask(TaskServiceImpl.java:135)
   at com.myCompany.CreateTaskListener.notify(CreateTaskListener.java:30)
   at org.activiti.engine.impl.delegate.TaskListenerInvocation.invoke(TaskListenerInvocation.java:34)
   at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
   at org.activiti.engine.impl.bpmn.helper.ClassDelegate.notify(ClassDelegate.java:90)
   at org.activiti.engine.impl.delegate.TaskListenerInvocation.invoke(TaskListenerInvocation.java:34)
   at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:512)
   at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.execute(UserTaskActivityBehavior.java:70)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)
        ….

Is this a bug?
2 REPLIES 2

ingo_ri
Champ in-the-making
Champ in-the-making
Don't use the external api in the handler, try

  TaskEntity task = (TaskEntity) delegateTask;
  List<IdentityLinkEntity> identityLinks = task.getIdentityLinks();

partizano
Champ in-the-making
Champ in-the-making
Thanks, ingo_ri Smiley Wink