Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlgoubet2011-08-09 07:38:14 +0000
committerlgoubet2011-08-09 07:38:14 +0000
commitba55e157547e2562f96c774913530b31c0ef11c3 (patch)
tree72805a472c2b7fd3249201b1fad83cb59a712819
parentd8075d1557c76ee3c2445b6b8e2e43b108ccf426 (diff)
downloadorg.eclipse.emf.compare-mergetests.tar.gz
org.eclipse.emf.compare-mergetests.tar.xz
org.eclipse.emf.compare-mergetests.zip
Make the "scope" unit tests pass : we had an NPE with scoped matching.mergetests
-rw-r--r--plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/engine/check/ReferencesCheck.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/engine/check/ReferencesCheck.java b/plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/engine/check/ReferencesCheck.java
index 1d2ddb046..46e8dc384 100644
--- a/plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/engine/check/ReferencesCheck.java
+++ b/plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/engine/check/ReferencesCheck.java
@@ -141,12 +141,13 @@ public class ReferencesCheck extends AbstractCheck {
final List<Integer> removedIndices = new ArrayList<Integer>();
// Purge "left" list of all reference values that have been added to it
for (EObject leftValue : new ArrayList<EObject>(leftElementReferences)) {
- if (isUnmatched(leftValue)
+ if (!isInScope(leftValue) || isUnmatched(leftValue)
|| getMatchedEObject(leftValue.eContainer()) != getMatchedEObject(leftValue).eContainer())
leftElementReferences.remove(leftValue);
}
for (EObject rightValue : new ArrayList<EObject>(rightElementReferences)) {
- if (isUnmatched(rightValue)
+ if (!isInScope(rightValue)
+ || isUnmatched(rightValue)
|| getMatchedEObject(rightValue.eContainer()) != getMatchedEObject(rightValue)
.eContainer()) {
removedIndices.add(Integer.valueOf(rightElementReferences.indexOf(rightValue)));
@@ -155,10 +156,10 @@ public class ReferencesCheck extends AbstractCheck {
int expectedIndex = 0;
for (int i = 0; i < leftElementReferences.size(); i++) {
final EObject matched = getMatchedEObject(leftElementReferences.get(i));
- for (final Integer removedIndice : new ArrayList<Integer>(removedIndices)) {
- if (i == removedIndice) {
+ for (final Integer removedIndex : new ArrayList<Integer>(removedIndices)) {
+ if (expectedIndex == removedIndex) {
expectedIndex += 1;
- removedIndices.remove(removedIndice);
+ removedIndices.remove(removedIndex);
}
}
if (rightElementReferences.indexOf(matched) != expectedIndex++) {

Back to the top