Community
Participate
Working Groups
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) [...]
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".
New Gerrit change created: https://git.eclipse.org/r/56535