Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbrun2007-08-16 09:28:03 +0000
committercbrun2007-08-16 09:28:03 +0000
commit8303a3a61bea0b0e2a635de4aa0f9d5e394a59b6 (patch)
tree03c21585388ff8cb4e44d8cea324880d30ca1498
parent90922125c7fa3f158700d522442a7001a61606af (diff)
downloadorg.eclipse.emf.compare-8303a3a61bea0b0e2a635de4aa0f9d5e394a59b6.tar.gz
org.eclipse.emf.compare-8303a3a61bea0b0e2a635de4aa0f9d5e394a59b6.tar.xz
org.eclipse.emf.compare-8303a3a61bea0b0e2a635de4aa0f9d5e394a59b6.zip
[199246] potential NPE with compare editor + export API
-rw-r--r--plugins/org.eclipse.emf.compare.diff/build.properties5
-rw-r--r--plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/generic/DiffMaker.java6
2 files changed, 7 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.compare.diff/build.properties b/plugins/org.eclipse.emf.compare.diff/build.properties
index 4edcc9f0e..ace8ccf23 100644
--- a/plugins/org.eclipse.emf.compare.diff/build.properties
+++ b/plugins/org.eclipse.emf.compare.diff/build.properties
@@ -1,13 +1,14 @@
# <copyright>
# </copyright>
#
-# $Id: build.properties,v 1.1 2007/04/03 06:45:25 cbrun Exp $
+# $Id: build.properties,v 1.1.2.1 2007/08/16 09:28:03 cbrun Exp $
bin.includes = .,\
model/,\
META-INF/,\
plugin.xml,\
- plugin.properties
+ plugin.properties,\
+ schema/
jars.compile.order = .
source.. = src/
output.. = bin/
diff --git a/plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/generic/DiffMaker.java b/plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/generic/DiffMaker.java
index c6bcbc93e..55a3d1ecf 100644
--- a/plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/generic/DiffMaker.java
+++ b/plugins/org.eclipse.emf.compare.diff/src/org/eclipse/emf/compare/diff/generic/DiffMaker.java
@@ -67,6 +67,8 @@ public class DiffMaker implements DiffEngine {
public DiffModel doDiff(MatchModel match) {
updateEObjectToMatch(match);
final DiffModel result = DiffFactory.eINSTANCE.createDiffModel();
+ result.setLeft(match.getLeftModel());
+ result.setRight(match.getRightModel());
// we have to browse the model and create the corresponding operations
final Match2Elements matchRoot = (Match2Elements)match.getMatchedElements().get(0);
final Resource leftModel = matchRoot.getLeftElement().eResource();
@@ -261,7 +263,7 @@ public class DiffMaker implements DiffEngine {
if (leftValue != null && !leftValue.equals(rightValue) && next.isMany()) {
// If an object in the left list isn't contained in the right, it is a remove operation
for (Object aValue : (List)leftValue) {
- if (!((List)rightValue).contains(aValue)) {
+ if (!((List)rightValue).contains(aValue) && aValue instanceof EObject) {
final RemoveAttribute operation = DiffFactory.eINSTANCE.createRemoveAttribute();
operation.setAttribute(next);
operation.setRightElement(mapping.getRightElement());
@@ -271,7 +273,7 @@ public class DiffMaker implements DiffEngine {
}
}
for (Object aValue : (List)rightValue) {
- if (!((List)leftValue).contains(aValue)) {
+ if (!((List)leftValue).contains(aValue) && aValue instanceof EObject) {
final AddAttribute operation = DiffFactory.eINSTANCE.createAddAttribute();
operation.setAttribute(next);
operation.setRightElement(mapping.getRightElement());

Back to the top