Bug 476299 - NullPointer when merging a ReferenceChange concerning a ResourceAttachment-Delete right to left
Summary: NullPointer when merging a ReferenceChange concerning a ResourceAttachment-De...
Status: ASSIGNED
Alias: None
Product: EMFCompare
Classification: Modeling
Component: Core (show other bugs)
Version: 3.0.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: Neon   Edit
Assignee: Mathieu Cartaud CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-01 08:28 EDT by Stefan Dirix CLA
Modified: 2017-09-05 09:14 EDT (History)
5 users (show)

See Also:


Attachments
Testcase for ResourceAttachment-DELETE NullPointer (5.74 KB, patch)
2015-09-01 08:28 EDT, Stefan Dirix CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Dirix CLA 2015-09-01 08:28:03 EDT
Created attachment 256281 [details]
Testcase for ResourceAttachment-DELETE NullPointer

When an eObject which was previously extracted to its own resource is moved back and the generated differences are merged right to left, a NullPointerException occurs.

Consider the following scenario:
(Testcase with this scenario is attached to the bug report)

LEFT
====
Resource: left
|- Node: id="ROOT"
   |- Node: id="NEW ROOT"

RIGHT
=====
Resource: right
|- Node: id="NEW ROOT"

Resource: right2
|- Node: id="ROOT"

EMFCompare generates a ResourceAttachmentChange-DELETE and a ReferenceChange regarding a move of "NEW ROOT". When these differences are merged right to left, the following NullPointerException occurs:

java.lang.NullPointerException
	at org.eclipse.emf.compare.merge.ReferenceChangeMerger.moveElement(ReferenceChangeMerger.java:192)
	at org.eclipse.emf.compare.merge.ReferenceChangeMerger.reject(ReferenceChangeMerger.java:81)
	at org.eclipse.emf.compare.merge.AbstractMerger.copyRightToLeft(AbstractMerger.java:681)
	at org.eclipse.emf.compare.merge.BatchMerger.copyAllRightToLeft(BatchMerger.java:114)
[...]
Comment 1 Mathieu Cartaud CLA 2015-09-22 10:25:28 EDT
The problem seems to come from the detection of a wrong kind of ResourceAttachmentChange.
In your example, the kind of the ResourceAttachmentChange is Move but it should be Delete since no reference to newRoot is present in the resource "right".
Comment 2 Eclipse Genie CLA 2015-09-23 11:43:29 EDT
New Gerrit change created: https://git.eclipse.org/r/56535