Program: 93674
Project: 93674
Buggy source:
/** 
 * This will check the given <code>reference</code> for modification between <code>leftElement</code> and <code>rightElement</code> and create the corresponding   {@link DiffElement}s under the given  {@link DiffGroup}.
 * @param root {@link DiffGroup Root} of the {@link DiffElement}s to create.
 * @param reference {@link EReference} to check for modifications.
 * @param leftElement Element corresponding to the final value for the given reference.
 * @param rightElement Element corresponding to the initial value for the given reference.
 * @throws FactoryException Thrown if we cannot fetch <code>reference</code>'s values for either the left or the right element.
 */
private void createNonConflictingReferencesUpdate(DiffGroup root,EReference reference,EObject leftElement,EObject rightElement) throws FactoryException {
  final List<Object> leftElementObjReferences=convertFeatureMapList(EFactory.eGetAsList(leftElement,reference.getName()));
  final List<Object> rightElementObjReferences=convertFeatureMapList(EFactory.eGetAsList(rightElement,reference.getName()));
  final List<EObject> leftElementReferences=new ArrayList<EObject>();
  final List<EObject> rightElementReferences=new ArrayList<EObject>();
  for (  Object left : leftElementObjReferences) {
    leftElementReferences.add((EObject)left);
  }
  for (  Object right : rightElementObjReferences) {
    rightElementReferences.add((EObject)right);
  }
  final List<EObject> deletedReferences=computeDeletedReferences(leftElementReferences,rightElementReferences);
  final List<EObject> addedReferences=computeAddedReferences(leftElementReferences,rightElementReferences);
  if (!reference.isMany()) {
    EObject addedValue=null;
    EObject deletedValue=null;
    if (addedReferences.size() > 0) {
      addedValue=addedReferences.get(0);
    }
    if (deletedReferences.size() > 0) {
      deletedValue=deletedReferences.get(0);
    }
    if (areDistinct(addedValue,deletedValue)) {
      root.getSubDiffElements().add(createUpdatedReferenceOperation(leftElement,rightElement,reference,addedValue,deletedValue));
    }
  }
 else {
    deletedReferences.removeAll(addedReferences);
    addedReferences.removeAll(deletedReferences);
    final List<ReferenceChangeLeftTarget> addedReferencesDiffs=new ArrayList<ReferenceChangeLeftTarget>(addedReferences.size());
    final List<ReferenceChangeRightTarget> removedReferencesDiffs=new ArrayList<ReferenceChangeRightTarget>(deletedReferences.size());
    if (addedReferences.size() > 0) {
      addedReferencesDiffs.addAll(createNewReferencesOperation(root,leftElement,rightElement,reference,addedReferences));
    }
    if (deletedReferences.size() > 0) {
      removedReferencesDiffs.addAll(createRemovedReferencesOperation(root,leftElement,rightElement,reference,deletedReferences));
    }
    if (reference.isOrdered()) {
      checkReferenceOrderChange(root,reference,leftElement,rightElement,addedReferencesDiffs,removedReferencesDiffs);
    }
  }
}

Fixed version (ground truth):
/** 
 * This will check the given <code>reference</code> for modification between <code>leftElement</code> and <code>rightElement</code> and create the corresponding   {@link DiffElement}s under the given  {@link DiffGroup}.
 * @param root {@link DiffGroup Root} of the {@link DiffElement}s to create.
 * @param reference {@link EReference} to check for modifications.
 * @param leftElement Element corresponding to the final value for the given reference.
 * @param rightElement Element corresponding to the initial value for the given reference.
 * @throws FactoryException Thrown if we cannot fetch <code>reference</code>'s values for either the left or the right element.
 */
private void createNonConflictingReferencesUpdate(DiffGroup root,EReference reference,EObject leftElement,EObject rightElement) throws FactoryException {
  final List<Object> leftElementObjReferences=convertFeatureMapList(EFactory.eGetAsList(leftElement,reference.getName()));
  final List<Object> rightElementObjReferences=convertFeatureMapList(EFactory.eGetAsList(rightElement,reference.getName()));
  final List<EObject> leftElementReferences=new ArrayList<EObject>();
  final List<EObject> rightElementReferences=new ArrayList<EObject>();
  for (  Object left : leftElementObjReferences) {
    leftElementReferences.add((EObject)left);
  }
  for (  Object right : rightElementObjReferences) {
    rightElementReferences.add((EObject)right);
  }
  final List<EObject> deletedReferences=computeDeletedReferences(leftElementReferences,rightElementReferences);
  final List<EObject> addedReferences=computeAddedReferences(leftElementReferences,rightElementReferences);
  if (!reference.isMany()) {
    EObject addedValue=null;
    EObject deletedValue=null;
    if (addedReferences.size() > 0) {
      addedValue=addedReferences.get(0);
    }
    if (deletedReferences.size() > 0) {
      deletedValue=deletedReferences.get(0);
    }
    if (getMatchManager().isUnmatched(addedValue) || getMatchManager().isUnmatched(deletedValue) || areDistinct(addedValue,deletedValue)) {
      root.getSubDiffElements().add(createUpdatedReferenceOperation(leftElement,rightElement,reference,addedValue,deletedValue));
    }
  }
 else {
    deletedReferences.removeAll(addedReferences);
    addedReferences.removeAll(deletedReferences);
    final List<ReferenceChangeLeftTarget> addedReferencesDiffs=new ArrayList<ReferenceChangeLeftTarget>(addedReferences.size());
    final List<ReferenceChangeRightTarget> removedReferencesDiffs=new ArrayList<ReferenceChangeRightTarget>(deletedReferences.size());
    if (addedReferences.size() > 0) {
      addedReferencesDiffs.addAll(createNewReferencesOperation(root,leftElement,rightElement,reference,addedReferences));
    }
    if (deletedReferences.size() > 0) {
      removedReferencesDiffs.addAll(createRemovedReferencesOperation(root,leftElement,rightElement,reference,deletedReferences));
    }
    if (reference.isOrdered()) {
      checkReferenceOrderChange(root,reference,leftElement,rightElement,addedReferencesDiffs,removedReferencesDiffs);
    }
  }
}