Community
Participate
Working Groups
Created attachment 169998 [details] Diff Model I get the following exception while merging to models: ----------------------------------------------------------------------------- Exception in thread "Thread-6" java.lang.NullPointerException at org.eclipse.emf.compare.diff.merge.EMFCompareEObjectCopier.copyReferences(EMFCompareEObjectCopier.java:89) at org.eclipse.emf.compare.diff.merge.DefaultMerger.copy(DefaultMerger.java:131) at org.eclipse.emf.compare.diff.internal.merge.impl.ModelElementChangeLeftTargetMerger.undoInTarget(ModelElementChangeLeftTargetMerger.java:66) at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:166) at org.eclipse.emf.compare.diff.merge.service.MergeService.merge(MergeService.java:130) at org.eclipse.emf.compare.diff.internal.merge.impl.DiffGroupMerger.undoInTarget(DiffGroupMerger.java:48) at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:166) at org.eclipse.emf.compare.diff.merge.service.MergeService.merge(MergeService.java:130) at org.eclipse.emf.compare.diff.internal.merge.impl.DiffGroupMerger.undoInTarget(DiffGroupMerger.java:48) at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:166) at org.eclipse.emf.compare.diff.merge.service.MergeService.merge(MergeService.java:130) at org.eclipse.emf.compare.diff.internal.merge.impl.DiffGroupMerger.undoInTarget(DiffGroupMerger.java:48) at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:166) at org.eclipse.emf.compare.diff.merge.service.MergeService.merge(MergeService.java:130) ----------------------------------------------------------------------------- As I can see the problem is that the entrySet in copyReferences() contains a key-value-pair where the key is null. final EObject eObject = entry.getKey(); final EObject copyEObject = entry.getValue(); final EClass eClass = eObject.eClass(); //This one throws the NullPointerException
I have exactly the same issue, however, using doContentMatch rather than doMatch seems to circumvent the issue.
Okay, rather oddly, it only worked once and is now behaving as before...
I have never been able to reproduce this, and there should never be a "null" key in the copier. Stef, zzett, do you still remember how to reproduce this issue, or can provide sample models that present it when merging?
Never reproduced
I am also facing the same problem. Could you please assist me on this?
Venu, This issue has never been reproduced by the dev team... If you have a use case on which we can reproduce to track the problem, please attach it to this bug and reopen it. Do note that the main endeavour is now on EMF Compare 2.0 rather than 1.3. You may want to try one of the latest builds to see if you can reproduce your bug with it... You can download the 2.0 release on the update site : http://download.eclipse.org/modeling/emf/compare/updates/releases/2.0
Hi Lurent, Thanks for the quick reply. When I click the link which you mentioned above, then I got "Not Found" error. Could you please provide some way to download compare 2.0 ? I downloaded from some site [org.eclipse.emf.compare_2.0.0.201208311512.jar] and when I use that I got error on this line. ModelUtils.load(new File(file1), resourceSet1); // ModelUtils cannot be resolved When I search on compare2.0 jar file, there is no ModelUtils class file in this location [org.eclipse.emf.compare.util.ModelUtils] Am I using correct jar file? Or do I need to use ModelUtils in a different way? Could you please elaborate this? Thanks!
Venu, This is not a "clickable" link, it is a p2 update site. From your Eclipse, use Help > Install new software... and use that URL there. As for the code you use ... "ModelUtils" has indeed disappeared from EMF Compare in version 2.0 : most of the API has changed. I asked you to try this new version as I thought you were using the UI to compare your models. If you use code, switching to 2.0 will require a little work from your side in order to migrate your code. If you intend to give this version a try, please look at the test plugins for samples of code on "how to launch a comparison". The code can be retrieved from the git repository "http://git.eclipse.org/gitroot/emfcompare/org.eclipse.emf.compare.git"; or you can look at the code from the web interface at : http://git.eclipse.org/c/emfcompare/org.eclipse.emf.compare.git/tree/plugins/org.eclipse.emf.compare.tests .