cancel
Showing results for 
Search instead for 
Did you mean: 

multiInstanceLoopCharacteristics with an empty list

harry11
Champ in-the-making
Champ in-the-making
Hello,

I'm using a multiInstanceLoopCharacteristics with a List in my Activiti process. It works fine, except when the list is empty (the list is not null, it's just empty).
When the list is empty I have this error :

19 mai 2011 16:42:14 org.activiti.engine.impl.interceptor.CommandContext close
GRAVE: Error while closing command context
org.activiti.engine.ActivitiException: Invalid number of instances: must be positive integer value, but was 0
at org.activiti.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior.createInstances(ParallelMultiInstanceBehavior.java:42)
at org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.execute(MultiInstanceActivityBehavior.java:82)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:40)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)


I think it should work when there is no instance in the list (and just skip the loop), shouldn't it ?

Regards,
17 REPLIES 17

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
(my bad) Smiley Wink

You can't know everything, believe me…… I've tried…. for several hundered years now…

frederikherema1
Star Contributor
Star Contributor
You can't know everything, believe me…… I've tried…. for several hundered years now…

ROFL

p4w3l
Champ in-the-making
Champ in-the-making
It is annoying having extra gateway to test collection emptiness. If you see no reason to restrict empty collections maybe they could be allowed?

melentye
Champ in-the-making
Champ in-the-making
I second that, if it doesn't violate the BPMN2 spec or any other standards, it would be more convenient to skip for-each loops on empty collections without using an additional gateway

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Fastest way to get this fixed is to fork the code on github, createva patch, add a testcase and make sure all other tests still run fine. Then createva pull request et voila…

dromie
Champ in-the-making
Champ in-the-making
Hi,

I ran into the same situation, and I've made the modification as well.
Here you go: https://github.com/Activiti/Activiti/pull/364
Should I also raise a Jira ticket for this?

Cheers,
dromie

guillaume1
Champ on-the-rise
Champ on-the-rise
Hi,

What is the status of this request ?
Is it already included in latest version of Activiti ? Is it planned to include it ?

We have a lots of cases where the multi instance collection is generated dynamically and empty lists are a valid result from the service point of view.

Cheers,
Guillaume.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

yes it is supported since September 2014. e.g org.activiti.engine.test.bpmn.multiinstance.MultiInstanceTest#testSequentialEmptyCollection
Regards
Martin