]
Huisheng Xu reassigned JBPM-2677:
---------------------------------
Assignee: Huisheng Xu
Migration of process instances fails when there are no process
instances
------------------------------------------------------------------------
Key: JBPM-2677
URL:
https://jira.jboss.org/jira/browse/JBPM-2677
Project: jBPM
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 4.2
Reporter: Edgar Vonk
Assignee: Huisheng Xu
When the process definition includes a 'migrate-instances' entry like:
{code}
<migrate-instances versions="*"/>
{code}
The migration of process instances fails when there are no process instances in the jBPM
database:
{quote}
EXCEPTION ###########################################
16:15:36,793 INF | [DefaultCommandService] exception while executing command
org.jbpm.pvm.internal.cmd.DeployCmd@1a550
f9
java.lang.IndexOutOfBoundsException: fromIndex = -1
at java.util.SubList.<init>(AbstractList.java:600)
at java.util.RandomAccessSubList.<init>(AbstractList.java:758)
at java.util.AbstractList.subList(AbstractList.java:468)
at
org.jbpm.pvm.internal.migration.InstanceMigrator.getProcessesToMigrate(InstanceMigrator.java:104)
at
org.jbpm.pvm.internal.migration.InstanceMigrator.getProcessInstancesToMigrate(InstanceMigrator.java:84)
[..]
{quote}
This issue is caused by the following code in the InstanceMigrator class:
{code}
private static List<ProcessDefinition> getProcessesToMigrate(String
processDefinitionName, MigrationDescriptor migrationDescriptor) {
RepositorySession repositorySession =
EnvironmentImpl.getFromCurrent(RepositorySession.class);
List<ProcessDefinition> processDefinitions = repositorySession
.createProcessDefinitionQuery()
.processDefinitionName(processDefinitionName)
.orderAsc(ProcessDefinitionQuery.PROPERTY_VERSION)
.list();
int startIndex = calculateStartIndex(processDefinitions.size() - 1,
migrationDescriptor);
int endIndex = calculateEndIndex(processDefinitions.size() - 1,
migrationDescriptor);
if (startIndex > endIndex) startIndex = endIndex;
return processDefinitions.subList(startIndex, endIndex);
}
{code}
No check is done to see if the list of processes (processDefinitions) is not empty.
This issue causes our unit tests to fail since our unit tests start with an empty jBPM
database.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: