cancel
Showing results for 
Search instead for 
Did you mean: 

TaskService.createAttachment requires taskID?

davidk1
Champ in-the-making
Champ in-the-making
Hi,

after upgrading from 5.10 to 5.11 my code stops running.

When calling method taskService.createAttachment(   "xx",
                  null,
                  instanceID,
                  "Letter",
                  "-",
                  "http://server");

I get now the exception:

6.12.2012 21:03:24 org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
org.activiti.engine.ActivitiException: taskId is null
        at org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:42)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterce
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
        at org.activiti.engine.impl.TaskServiceImpl.createAttachment(TaskServiceImpl.java:279)
        at vf.service.CreateLiveDocListener.notify(CreateLiveDocListener.java:41)

……
   
I cannot find any method to retrieve the taskID from context:

public class CreateLiveDocListener implements ExecutionListener {
   public void notify(DelegateExecution execution) throws Exception {

   }
}

Regards
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
Yes, I made that mistake. While introducing the suspend/activate functionality, I overzealously made the taskId mandatory. Sorry about that.
The fact there were no tests doesn't help either (*that* was *not* my fault 😉 )

I fixed it on master: https://github.com/Activiti/Activiti/commit/528f4bd9cb05c11f2b265a73958b90e77ab791a1

What you can do:
- Wait until we publish a 5.12 snapshot next week
- Copy the CreateAttachmentCmd, include it in your source code and run it through the command executor instead of calling the service.

And yes, I added a test which tests this use case … Smiley Tongue

gunnar1
Champ in-the-making
Champ in-the-making
Thanks for the quick response and solution  Smiley Happy  Smiley Very Happy

activista
Champ in-the-making
Champ in-the-making
Yes, I made that mistake. While introducing the suspend/activate functionality, I overzealously made the taskId mandatory. Sorry about that.
The fact there were no tests doesn't help either (*that* was *not* my fault 😉 )

I fixed it on master: https://github.com/Activiti/Activiti/commit/528f4bd9cb05c11f2b265a73958b90e77ab791a1

What you can do:
- Wait until we publish a 5.12 snapshot next week
- Copy the CreateAttachmentCmd, include it in your source code and run it through the command executor instead of calling the service.

And yes, I added a test which tests this use case … Smiley Tongue

Hello All,

Any news about by when 5.12 snapshot could be available with this correction?

Regards

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Now, if you checkout the source and do a 'mvn install'