Program: 93693
Project: 93693
Buggy source:
/** 
 * This will check for remote ReferenceChange operations and create the corresponding   {@link DiffElement}s.<br/> <p> A reference is considered &quot;remotely changed&quot; if its values differ between the right (latest from HEAD) and origin (common ancestor) model, but its values haven't changed between the left (working copy) and the origin model. </p>
 * @param root {@link DiffGroup Root} of the {@link DiffElement}s to create.
 * @param reference {@link EReference} to check for ReferenceChanges.
 * @param mapping Contains informations about the left, right and original model elements.
 * @param remotelyAdded {@link List} of reference values that have been added in the left model since the origin.
 * @param remotelyDeleted {@link List} of reference values that have been removed from the left model since theorigin.
 */
private void createRemoteReferencesUpdate(DiffGroup root,EReference reference,Match3Elements mapping,List<EObject> remotelyAdded,List<EObject> remotelyDeleted){
  if (!reference.isMany() && remotelyAdded.size() > 0 && remotelyDeleted.size() > 0) {
    final UpdateReference operation=DiffFactory.eINSTANCE.createUpdateReference();
    operation.setRemote(true);
    operation.setLeftElement(mapping.getLeftElement());
    operation.setRightElement(mapping.getRightElement());
    operation.setReference(reference);
    EObject leftTarget=getMatchedEObject(remotelyAdded.get(0));
    EObject rightTarget=getMatchedEObject(remotelyDeleted.get(0));
    if (leftTarget == null) {
      leftTarget=remotelyAdded.get(0);
    }
    if (rightTarget == null) {
      rightTarget=remotelyDeleted.get(0);
    }
    operation.setLeftTarget(leftTarget);
    operation.setRightTarget(rightTarget);
    root.getSubDiffElements().add(operation);
  }
 else   if (reference.isMany()) {
    final Iterator<EObject> addedReferenceIterator=remotelyAdded.iterator();
    while (addedReferenceIterator.hasNext()) {
      final EObject eobj=addedReferenceIterator.next();
      final ReferenceChangeRightTarget addOperation=DiffFactory.eINSTANCE.createReferenceChangeRightTarget();
      addOperation.setRemote(true);
      addOperation.setRightElement(mapping.getRightElement());
      addOperation.setLeftElement(mapping.getLeftElement());
      addOperation.setReference(reference);
      addOperation.setRightTarget(eobj);
      if (getMatchedEObject(eobj) != null) {
        addOperation.setLeftTarget(getMatchedEObject(eobj));
      }
      root.getSubDiffElements().add(addOperation);
    }
    final Iterator<EObject> deletedReferenceIterator=remotelyDeleted.iterator();
    while (deletedReferenceIterator.hasNext()) {
      final EObject eobj=deletedReferenceIterator.next();
      final ReferenceChangeLeftTarget delOperation=DiffFactory.eINSTANCE.createReferenceChangeLeftTarget();
      delOperation.setRemote(true);
      delOperation.setRightElement(mapping.getRightElement());
      delOperation.setLeftElement(mapping.getLeftElement());
      delOperation.setReference(reference);
      delOperation.setLeftTarget(eobj);
      if (getMatchedEObject(eobj) != null) {
        delOperation.setRightTarget(getMatchedEObject(eobj));
      }
      root.getSubDiffElements().add(delOperation);
    }
  }
}

Fixed version (ground truth):
/** 
 * This will check for remote ReferenceChange operations and create the corresponding   {@link DiffElement}s.<br/> <p> A reference is considered &quot;remotely changed&quot; if its values differ between the right (latest from HEAD) and origin (common ancestor) model, but its values haven't changed between the left (working copy) and the origin model. </p>
 * @param root {@link DiffGroup Root} of the {@link DiffElement}s to create.
 * @param reference {@link EReference} to check for ReferenceChanges.
 * @param mapping Contains informations about the left, right and original model elements.
 * @param remotelyAdded {@link List} of reference values that have been added in the left model since the origin.
 * @param remotelyDeleted {@link List} of reference values that have been removed from the left model since theorigin.
 */
private void createRemoteReferencesUpdate(DiffGroup root,EReference reference,Match3Elements mapping,List<EObject> remotelyAdded,List<EObject> remotelyDeleted){
  if (!reference.isMany() && remotelyAdded.size() > 0 && remotelyDeleted.size() > 0) {
    final UpdateReference operation=DiffFactory.eINSTANCE.createUpdateReference();
    operation.setRemote(true);
    operation.setLeftElement(mapping.getLeftElement());
    operation.setRightElement(mapping.getRightElement());
    operation.setReference(reference);
    EObject rightTarget=getMatchedEObject(remotelyAdded.get(0));
    EObject leftTarget=getMatchedEObject(remotelyDeleted.get(0));
    if (leftTarget == null) {
      leftTarget=remotelyAdded.get(0);
    }
    if (rightTarget == null) {
      rightTarget=remotelyDeleted.get(0);
    }
    operation.setLeftTarget(leftTarget);
    operation.setRightTarget(rightTarget);
    root.getSubDiffElements().add(operation);
  }
 else   if (reference.isMany()) {
    final Iterator<EObject> addedReferenceIterator=remotelyAdded.iterator();
    while (addedReferenceIterator.hasNext()) {
      final EObject eobj=addedReferenceIterator.next();
      final ReferenceChangeRightTarget addOperation=DiffFactory.eINSTANCE.createReferenceChangeRightTarget();
      addOperation.setRemote(true);
      addOperation.setRightElement(mapping.getRightElement());
      addOperation.setLeftElement(mapping.getLeftElement());
      addOperation.setReference(reference);
      addOperation.setRightTarget(eobj);
      if (getMatchedEObject(eobj) != null) {
        addOperation.setLeftTarget(getMatchedEObject(eobj));
      }
      root.getSubDiffElements().add(addOperation);
    }
    final Iterator<EObject> deletedReferenceIterator=remotelyDeleted.iterator();
    while (deletedReferenceIterator.hasNext()) {
      final EObject eobj=deletedReferenceIterator.next();
      final ReferenceChangeLeftTarget delOperation=DiffFactory.eINSTANCE.createReferenceChangeLeftTarget();
      delOperation.setRemote(true);
      delOperation.setRightElement(mapping.getRightElement());
      delOperation.setLeftElement(mapping.getLeftElement());
      delOperation.setReference(reference);
      delOperation.setLeftTarget(eobj);
      if (getMatchedEObject(eobj) != null) {
        delOperation.setRightTarget(getMatchedEObject(eobj));
      }
      root.getSubDiffElements().add(delOperation);
    }
  }
}