Community
Participate
Working Groups
Build Identifier: 3.0 When merging 2 branches, the indices of the FeatureDeltas have to be adjusted. The special case "add element at index 0" does not seem to be handled in adjustAfterRemoval of CDOSingleValueFeatureDelta and CDOMoveFeatureDelta leading to a negative index (-1) and causing an IndexOutOfBoundsException when applying: java.lang.IndexOutOfBoundsException: Index: -1, Size: 1 at java.util.ArrayList.add(Unknown Source) at org.eclipse.emf.cdo.internal.common.revision.delta.CDOAddFeatureDeltaImpl.apply(CDOAddFeatureDeltaImpl.java:50) at org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl.apply(CDOListFeatureDeltaImpl.java:248) at org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl.apply(CDORevisionDeltaImpl.java:191) at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.applyChangeSetData(CDOTransactionImpl.java:483) at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.merge(CDOTransactionImpl.java:358) The same happens in CDONotificationBuilder, but the problem is not immediately visible. Reproducible: Always Steps to Reproduce: 1. Create 2 branches (main and another branch). 2. Remove an element from a containment list in main branch, and add an element to the same list at index 0 in the other branch. 3. merge the other branch to main.
Created attachment 169823 [details] TestCase The test case contains two tests: - one for the merge case. - one for the notification.
Created attachment 169824 [details] proposed patch added a check if index is > 0 before decreasing.
Created attachment 169825 [details] proposed patch for CDOSingleValueFeatureDelta added a check if index > 0 before decreasing.
I patched CDOSingleValueFeatureDeltaImpl and CDOMoveFeatureDeltaImpl's adjustAfterRemoval method. However in CDOMoveFeatureDeltaImpl there also happens some index adjusting in the affectIndices method, which I didn't check and which also might need the > 0 check. 1) The number of lines that you added/changed is smaller than 250. confirmed 2) You are the only author of these changed lines. confirmed 3) You apply the EPL to these changed lines. confirmed
Thank you Pascal. The second test case (testNotificationBuilderTest) passes with the patches being applied. But the first one (testMergeTest) still fails and the cause seems unrelated to this bugzilla. It seems more related with bug 312534. For now I commented out the first test case until you have a chance to try it and give feedback. Committed to HEAD.
Okay, included the first test case again. Committed to HEAD.
Available in 3.0 GA: http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/