Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327901

Summary: NPE in ModelElementChangeRightTargetMerger
Product: [Modeling] EMFCompare Reporter: Bernd <berndvogt>
Component: CoreAssignee: EMF Compare <emf.compare-inbox>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: laurent.goubet, Michal.Tkacz
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Project with models to reproduce this bug
none
Detailed stack trace showing the NPE
none
Second NPE occurred on save
none
Yet anoter NPE none

Description Bernd CLA 2010-10-15 10:56:59 EDT
Build Identifier: I20100608-0911

Follow steps to reproduce.

I suspect that the exception has sth. to do with the annotations at the EPackages of the 'A' models. If the annotation will be removed before merging the two models the exception won't happen.

By the way, I don't understand the changes on the annotations? The annotations are absolutely identical.

Reproducible: Always

Steps to Reproduce:
1. Import attached project
2. Select Ecore file A1 and A2
3. Choose 'Compare With -> Each Other' from context menu
4. Choose 'Selected resource(s) only' from the 'Match Model Selection' dialog
5. Select the change on the attribute under the EClass Clazz
6. Perform 'Copy Current Change from right to left

-> NPE in ModelElementChangeRightTargetMerger.applyInOrigin(...), see attached trace
Comment 1 Bernd CLA 2010-10-15 10:58:34 EDT
Created attachment 180963 [details]
Project with models to reproduce this bug
Comment 2 Bernd CLA 2010-10-15 10:59:50 EDT
Created attachment 180965 [details]
Detailed stack trace showing the NPE
Comment 3 Bernd CLA 2010-10-15 11:25:40 EDT
After removing the annotations in the 'A' models (see attached project) I was able to compare and merge the attribute. Sadly, I can't save the result because of another NPE. This time in ModelContentMergeViewer.getContents(...), see attached trace2.txt.

Decided to increase importance. Due to this bugs emf compare is unusable.

Using EMF Compare SDK 1.1.1.v201009150438 from the Helios update site.
Comment 4 Bernd CLA 2010-10-15 11:27:16 EDT
Created attachment 180971 [details]
Second NPE occurred on save
Comment 5 Bernd CLA 2010-10-15 13:21:51 EDT
Created attachment 180992 [details]
Yet anoter NPE

Got another NPE while trying to perform a merge programatically.

java.lang.NullPointerException
	at org.eclipse.emf.compare.diff.internal.merge.impl.ModelElementChangeLeftTargetMerger.undoInTarget(ModelElementChangeLeftTargetMerger.java:98)
	at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:166)
Comment 6 Laurent Goubet CLA 2011-03-10 04:03:18 EST
The NPEs outlined here have been fixed, the fix will be available in 1.2.0M6.

As for the problem with your annotations being detected as modified, it is due to you selecting "Selected resource(s) only" in your step 4 (when comparing). Your annotations contain links to another model, and thus they won't be matched if you're not considering the whole resource set for the comparison.

The NPE when saving has not been reproduced, considered fixed until someone reproduces it and provides us with reproduction steps.