Program: 101968
Project: 101968
Buggy source:
/** 
 * EMF Model Generator execute
 * @param diffReport the difference report
 * @param targetModelResource the model resource
 * @param progressMonitor progress monitor
 * @param totalWork the total work units to be done
 * @return the execution status
 * @throws ModelerCoreException if problems building model
 */
public IStatus execute(DifferenceReport diffReport,ModelResource targetModelResource,IProgressMonitor progressMonitor,int totalWork) throws ModelerCoreException {
  clearLists();
  int workUnit=totalWork / 5;
  addRelationalExtensionAssistant(targetModelResource);
  progressMonitor.setTaskName(Messages.emfModelGenerator_generatingModel);
  progressMonitor.subTask(Messages.emfModelGenerator_deletingPrimaryObjects);
  List<RelationalReference> objsToDelete=diffReport.getObjectsToDelete().getList();
  for (  RelationalReference child : objsToDelete) {
    if (child.isChecked()) {
      deleteMatchingChild(targetModelResource,child);
    }
  }
  progressMonitor.worked(workUnit);
  progressMonitor.subTask(Messages.emfModelGenerator_creatingPrimaryObjects);
  List<RelationalReference> objsToCreate=diffReport.getObjectsToCreate().getList();
  for (  RelationalReference child : objsToCreate) {
    if (child.isChecked()) {
      createObject(child,targetModelResource);
    }
  }
  progressMonitor.worked(workUnit);
  progressMonitor.subTask(Messages.emfModelGenerator_updatingPrimaryObjects);
  List<RelationalReference> objsToUpdate=diffReport.getObjectsToUpdate().getList();
  for (  RelationalReference child : objsToUpdate) {
    if (child.isChecked()) {
      deleteMatchingChild(targetModelResource,child);
      createObject(child,targetModelResource);
    }
  }
  progressMonitor.worked(workUnit);
  progressMonitor.subTask(Messages.emfModelGenerator_creatingSecondaryObjects);
  if (!pkList.isEmpty()) {
    for (    DeferredPair item : pkList) {
      RelationalPrimaryKey pk=(RelationalPrimaryKey)item.getRelationalReference();
      BaseTable table=(BaseTable)item.getEObject();
      createPrimaryKey(pk,table,targetModelResource);
    }
  }
  if (!fkList.isEmpty()) {
    for (    DeferredPair item : fkList) {
      RelationalForeignKey fk=(RelationalForeignKey)item.getRelationalReference();
      BaseTable table=(BaseTable)item.getEObject();
      createForeignKey(fk,table,targetModelResource);
    }
  }
  if (!apList.isEmpty()) {
    for (    DeferredPair item : apList) {
      RelationalAccessPattern ap=(RelationalAccessPattern)item.getRelationalReference();
      Table table=(Table)item.getEObject();
      createAccessPattern(ap,table,targetModelResource);
    }
  }
  if (!ucList.isEmpty()) {
    for (    DeferredPair item : ucList) {
      RelationalUniqueConstraint uc=(RelationalUniqueConstraint)item.getRelationalReference();
      BaseTable table=(BaseTable)item.getEObject();
      createUniqueConstraint(uc,table,targetModelResource);
    }
  }
  if (!indexList.isEmpty()) {
    for (    RelationalIndex index : indexList) {
      createIndex(index,targetModelResource);
    }
  }
  progressMonitor.worked(workUnit);
  progressMonitor.subTask(Messages.emfModelGenerator_settingExtensionProps);
  if (!deferredProcessingList.isEmpty()) {
    for (    DeferredPair item : deferredProcessingList) {
      RelationalReference relRef=item.getRelationalReference();
      EObject eObj=item.getEObject();
      processExtensionProperties(targetModelResource,relRef,eObj);
      setDescription(eObj,relRef.getDescription(),targetModelResource);
    }
  }
  progressMonitor.worked(workUnit);
  MultiStatus multiStatus=new MultiStatus(RelationalPlugin.PLUGIN_ID,IStatus.OK,Messages.emfModelGenerator_modelGenerationSuccess,null);
  if (!this.propsWithNoAssistant.isEmpty()) {
    StringBuffer sb=new StringBuffer();
    Iterator iter=this.propsWithNoAssistant.iterator();
    while (iter.hasNext()) {
      String prop=(String)iter.next();
      sb.append(prop);
      if (iter.hasNext())       sb.append("String_Node_Str");
    }
    multiStatus.add(new Status(IStatus.WARNING,RelationalPlugin.PLUGIN_ID,0,NLS.bind(Messages.emfModelGenerator_warningAssistantForPropertyNotFound,sb.toString()),null));
  }
 else   if (!this.metaclassesWithNoAssistant.isEmpty()) {
    StringBuffer sb=new StringBuffer();
    Iterator iter=this.metaclassesWithNoAssistant.iterator();
    while (iter.hasNext()) {
      String prop=(String)iter.next();
      sb.append(prop);
      if (iter.hasNext())       sb.append("String_Node_Str");
    }
    multiStatus.add(new Status(IStatus.WARNING,RelationalPlugin.PLUGIN_ID,0,NLS.bind(Messages.emfModelGenerator_warningAssistantForMetaclassNotFound,sb.toString()),null));
  }
  clearLists();
  return multiStatus;
}

Fixed version (ground truth):
/** 
 * EMF Model Generator execute
 * @param diffReport the difference report
 * @param targetModelResource the model resource
 * @param progressMonitor progress monitor
 * @param totalWork the total work units to be done
 * @return the execution status
 * @throws ModelerCoreException if problems building model
 */
public IStatus execute(DifferenceReport diffReport,ModelResource targetModelResource,IProgressMonitor progressMonitor,int totalWork) throws ModelerCoreException {
  clearLists();
  int workUnit=totalWork / 5;
  addRelationalExtensionAssistant(targetModelResource);
  progressMonitor.setTaskName(Messages.emfModelGenerator_generatingModel);
  progressMonitor.subTask(Messages.emfModelGenerator_deletingPrimaryObjects);
  List<RelationalReference> objsToDelete=diffReport.getObjectsToDelete().getList();
  for (  RelationalReference child : objsToDelete) {
    if (child.isChecked()) {
      deleteMatchingChild(targetModelResource,child);
    }
  }
  progressMonitor.worked(workUnit);
  progressMonitor.subTask(Messages.emfModelGenerator_creatingPrimaryObjects);
  List<RelationalReference> objsToCreate=diffReport.getObjectsToCreate().getList();
  for (  RelationalReference child : objsToCreate) {
    if (child.isChecked()) {
      createObject(child,targetModelResource);
    }
  }
  progressMonitor.worked(workUnit);
  progressMonitor.subTask(Messages.emfModelGenerator_updatingPrimaryObjects);
  List<RelationalReference> objsToUpdate=diffReport.getObjectsToUpdate().getList();
  for (  RelationalReference child : objsToUpdate) {
    if (child.isChecked()) {
      deleteMatchingChild(targetModelResource,child);
      createObject(child,targetModelResource);
    }
  }
  progressMonitor.worked(workUnit);
  progressMonitor.subTask(Messages.emfModelGenerator_creatingSecondaryObjects);
  if (!pkList.isEmpty()) {
    for (    DeferredPair item : pkList) {
      RelationalPrimaryKey pk=(RelationalPrimaryKey)item.getRelationalReference();
      BaseTable table=(BaseTable)item.getEObject();
      createPrimaryKey(pk,table,targetModelResource);
    }
  }
  if (!ucList.isEmpty()) {
    for (    DeferredPair item : ucList) {
      RelationalUniqueConstraint uc=(RelationalUniqueConstraint)item.getRelationalReference();
      BaseTable table=(BaseTable)item.getEObject();
      createUniqueConstraint(uc,table,targetModelResource);
    }
  }
  if (!apList.isEmpty()) {
    for (    DeferredPair item : apList) {
      RelationalAccessPattern ap=(RelationalAccessPattern)item.getRelationalReference();
      Table table=(Table)item.getEObject();
      createAccessPattern(ap,table,targetModelResource);
    }
  }
  if (!indexList.isEmpty()) {
    for (    RelationalIndex index : indexList) {
      createIndex(index,targetModelResource);
    }
  }
  if (!fkList.isEmpty()) {
    for (    DeferredPair item : fkList) {
      RelationalForeignKey fk=(RelationalForeignKey)item.getRelationalReference();
      BaseTable table=(BaseTable)item.getEObject();
      createForeignKey(fk,table,targetModelResource);
    }
  }
  progressMonitor.worked(workUnit);
  progressMonitor.subTask(Messages.emfModelGenerator_settingExtensionProps);
  if (!deferredProcessingList.isEmpty()) {
    for (    DeferredPair item : deferredProcessingList) {
      RelationalReference relRef=item.getRelationalReference();
      EObject eObj=item.getEObject();
      processExtensionProperties(targetModelResource,relRef,eObj);
      setDescription(eObj,relRef.getDescription(),targetModelResource);
    }
  }
  progressMonitor.worked(workUnit);
  MultiStatus multiStatus=new MultiStatus(RelationalPlugin.PLUGIN_ID,IStatus.OK,Messages.emfModelGenerator_modelGenerationSuccess,null);
  if (!this.propsWithNoAssistant.isEmpty()) {
    StringBuffer sb=new StringBuffer();
    Iterator iter=this.propsWithNoAssistant.iterator();
    while (iter.hasNext()) {
      String prop=(String)iter.next();
      sb.append(prop);
      if (iter.hasNext())       sb.append("String_Node_Str");
    }
    multiStatus.add(new Status(IStatus.WARNING,RelationalPlugin.PLUGIN_ID,0,NLS.bind(Messages.emfModelGenerator_warningAssistantForPropertyNotFound,sb.toString()),null));
  }
 else   if (!this.metaclassesWithNoAssistant.isEmpty()) {
    StringBuffer sb=new StringBuffer();
    Iterator iter=this.metaclassesWithNoAssistant.iterator();
    while (iter.hasNext()) {
      String prop=(String)iter.next();
      sb.append(prop);
      if (iter.hasNext())       sb.append("String_Node_Str");
    }
    multiStatus.add(new Status(IStatus.WARNING,RelationalPlugin.PLUGIN_ID,0,NLS.bind(Messages.emfModelGenerator_warningAssistantForMetaclassNotFound,sb.toString()),null));
  }
  clearLists();
  return multiStatus;
}