Program: 139237
Project: 139237
Buggy source:
/** 
 * Open a compare editor UI, will clear the information which hasn't relationship with current selected level first(For example: if we compare the catalog level, will clear it's table(view) from every catalog), then will compare current level object.
 * @param rightResource
 * @param oldDataProviderFile
 * @return
 * @throws ReloadCompareException
 */
public static DiffModel openDiffCompareEditor(Resource leftResource,Resource rightResource,Map<String,Object> opt,IUIHandler guiHandler,IFile efmDiffResultFile,String dbName,Object selectedObject,boolean compareEachOther) throws ReloadCompareException {
  MatchModel match=null;
  try {
    match=MatchService.doResourceMatch(leftResource,rightResource,opt);
  }
 catch (  InterruptedException e) {
    throw new ReloadCompareException(e);
  }
  final DiffModel diff=DiffService.doDiff(match);
  final ComparisonResourceSnapshot snapshot=DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
  snapshot.setDate(Calendar.getInstance().getTime());
  snapshot.setMatch(match);
  snapshot.setDiff(diff);
  IFile createDiffResourceFile=efmDiffResultFile;
  try {
    final String fullPath=createDiffResourceFile.getLocation().toOSString();
    ModelUtils.save(snapshot,fullPath);
  }
 catch (  IOException e) {
    throw new ReloadCompareException(e);
  }
  if (guiHandler != null) {
    guiHandler.popComparisonUI(createDiffResourceFile.getLocation(),dbName,selectedObject,compareEachOther);
  }
  return diff;
}

Fixed version (ground truth):
/** 
 * Open a compare editor UI, will clear the information which hasn't relationship with current selected level first(For example: if we compare the catalog level, will clear it's table(view) from every catalog), then will compare current level object.
 * @param rightResource
 * @param oldDataProviderFile
 * @return
 * @throws ReloadCompareException
 */
public static DiffModel openDiffCompareEditor(Resource leftResource,Resource rightResource,Map<String,Object> opt,IUIHandler guiHandler,IFile efmDiffResultFile,String dbName,Object selectedObject,boolean compareEachOther) throws ReloadCompareException {
  MatchModel match=null;
  try {
    match=MatchService.doResourceMatch(leftResource,rightResource,opt);
  }
 catch (  InterruptedException e) {
    throw new ReloadCompareException(e);
  }
  final DiffModel diff=DiffService.doDiff(match);
  if (leftResource.getContents() == null || leftResource.getContents().size() == 0) {
    MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  EList<DiffElement> ownedElements=diff.getOwnedElements();
  for (  DiffElement de : ownedElements) {
    EList<DiffElement> subDiffElements=de.getSubDiffElements();
    for (    DiffElement difElement : subDiffElements) {
      if (difElement instanceof ModelElementChangeRightTarget) {
        ((ModelElementChangeRightTarget)difElement).setLeftParent(leftResource.getContents().get(0));
      }
    }
  }
  final ComparisonResourceSnapshot snapshot=DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
  snapshot.setDate(Calendar.getInstance().getTime());
  snapshot.setMatch(match);
  snapshot.setDiff(diff);
  IFile createDiffResourceFile=efmDiffResultFile;
  try {
    final String fullPath=createDiffResourceFile.getLocation().toOSString();
    ModelUtils.save(snapshot,fullPath);
  }
 catch (  IOException e) {
    throw new ReloadCompareException(e);
  }
  if (guiHandler != null) {
    guiHandler.popComparisonUI(createDiffResourceFile.getLocation(),dbName,selectedObject,compareEachOther);
  }
  return diff;
}