nus-yam/ex-repair huggingface dataset:
Program: 138025
Project: 138025
Buggy source:
@Override protected void handleAddElement(ModelElementChangeRightTarget addElement){
  EObject rightElement=addElement.getRightElement();
  TdColumn columnSetSwitch=SwitchHelpers.COLUMN_SWITCH.doSwitch(rightElement);
  if (columnSetSwitch != null) {
    ColumnSet columnSet=null;
    if (selectedObj instanceof DBColumnFolderRepNode) {
      DBColumnFolderRepNode columnFolderRepNode=(DBColumnFolderRepNode)selectedObj;
      columnSet=columnFolderRepNode.getColumnSet();
    }
 else     if (selectedObj instanceof ColumnSet) {
      columnSet=(ColumnSet)selectedObj;
    }
    ColumnSetHelper.addColumn(columnSetSwitch,columnSet);
    PrimaryKey primaryKey=ColumnHelper.getPrimaryKey(columnSetSwitch);
    if (primaryKey != null) {
      TableHelper.addPrimaryKey((TdTable)columnSet,primaryKey);
      PrimaryKey newPrimaryKey=TableHelper.addPrimaryKey((TdTable)columnSet,primaryKey);
      columnSetSwitch.getUniqueKey().remove(primaryKey);
      columnSetSwitch.getUniqueKey().add(newPrimaryKey);
    }
    Set<ForeignKey> foreignKeySet=ColumnHelper.getForeignKey(columnSetSwitch);
    for (    ForeignKey foreignKey : foreignKeySet) {
      if (foreignKey != null) {
        ForeignKey newForeignKey=TableHelper.addForeignKey((TdTable)columnSet,foreignKey);
        columnSetSwitch.getKeyRelationship().remove(foreignKey);
        columnSetSwitch.getKeyRelationship().add(newForeignKey);
      }
    }
    return;
  }
  TdExpression addedExpression=DataqualitySwitchHelper.TDEXPRESSION_SWITCH.doSwitch(rightElement);
  if (addedExpression != null) {
    TdColumn parentColumn=SwitchHelpers.COLUMN_SWITCH.doSwitch(addElement.getLeftParent());
    if (parentColumn != null) {
      parentColumn.setInitialValue(addedExpression);
    }
  }
}

Fixed version (ground truth):
@Override protected void handleAddElement(ModelElementChangeRightTarget addElement){
  EObject rightElement=addElement.getRightElement();
  TdColumn columnSetSwitch=SwitchHelpers.COLUMN_SWITCH.doSwitch(rightElement);
  if (columnSetSwitch != null) {
    ColumnSet columnSet=null;
    if (selectedObj instanceof DBColumnFolderRepNode) {
      DBColumnFolderRepNode columnFolderRepNode=(DBColumnFolderRepNode)selectedObj;
      columnSet=columnFolderRepNode.getColumnSet();
    }
 else     if (selectedObj instanceof ColumnSet) {
      columnSet=(ColumnSet)selectedObj;
    }
    ColumnSetHelper.addColumn(columnSetSwitch,columnSet);
    PrimaryKey primaryKey=ColumnHelper.getPrimaryKey(columnSetSwitch);
    TableHelper.addPrimaryKey((TdTable)columnSet,columnSetSwitch);
    Set<ForeignKey> foreignKeySet=ColumnHelper.getForeignKey(columnSetSwitch);
    for (    ForeignKey foreignKey : foreignKeySet) {
      TableHelper.addForeignKey((TdTable)columnSet,foreignKey,columnSetSwitch);
    }
    return;
  }
  TdExpression addedExpression=DataqualitySwitchHelper.TDEXPRESSION_SWITCH.doSwitch(rightElement);
  if (addedExpression != null) {
    TdColumn parentColumn=SwitchHelpers.COLUMN_SWITCH.doSwitch(addElement.getLeftParent());
    if (parentColumn != null) {
      parentColumn.setInitialValue(addedExpression);
    }
  }
}
Program: 138030
Project: 138030
Buggy source:
public void run(){
  ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}

Fixed version (ground truth):
public void run(){
  ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}
Program: 138031
Project: 138031
Buggy source:
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importToStucture(file,folder,type,page.getSkip(),page.getRename());
  if (0 < information.size()) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
      }
    }
);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importToStucture(file,folder,type,page.getSkip(),page.getRename());
  if (0 < information.size()) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
      }
    }
);
  }
  return true;
}
Program: 138032
Project: 138032
Buggy source:
private void updateUI(IJobChangeEvent event){
  final List<ReturnCode> information=new ArrayList<ReturnCode>();
  setEnabled(true);
  if (fExtensionDownloaded > 0) {
    for (    IEcosComponent componet : fInstalledComponents) {
      List<File> validFiles=extractFiles(componet,information);
      if (!validFiles.isEmpty()) {
        String categoryName=componet.getCategry().getName();
        EEcosCategory ecosCategory=EEcosCategory.getEcosCategory(categoryName);
        if (ecosCategory != null) {
          EResourceConstant resourceType=ecosCategory.getResource();
          for (          File oneFile : validFiles) {
            information.addAll(ImportFactory.doInport(resourceType,oneFile,componet.getName()));
          }
        }
      }
    }
    if (information.isEmpty()) {
      information.add(new ReturnCode(DefaultMessagesImpl.getString("String_Node_Str"),false));
    }
    ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
    CorePlugin.getDefault().refreshDQView();
  }
}

Fixed version (ground truth):
private void updateUI(IJobChangeEvent event){
  final List<ReturnCode> information=new ArrayList<ReturnCode>();
  setEnabled(true);
  if (fExtensionDownloaded > 0) {
    for (    IEcosComponent componet : fInstalledComponents) {
      List<File> validFiles=extractFiles(componet,information);
      if (!validFiles.isEmpty()) {
        String categoryName=componet.getCategry().getName();
        EEcosCategory ecosCategory=EEcosCategory.getEcosCategory(categoryName);
        if (ecosCategory != null) {
          EResourceConstant resourceType=ecosCategory.getResource();
          for (          File oneFile : validFiles) {
            information.addAll(ImportFactory.doInport(resourceType,oneFile,componet.getName()));
          }
        }
      }
    }
    if (information.isEmpty()) {
      information.add(new ReturnCode(DefaultMessagesImpl.getString("String_Node_Str"),false));
    }
    ImportInfoDialog.openImportInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
    CorePlugin.getDefault().refreshDQView();
  }
}
Program: 138033
Project: 138033
Buggy source:
public void run(){
  ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}

Fixed version (ground truth):
public void run(){
  ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}
Program: 138034
Project: 138034
Buggy source:
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importIndicatorToStucture(file,folder,page.getSkip(),page.getRename());
  if (information.isEmpty()) {
    information.add(new ReturnCode(DefaultMessagesImpl.getString("String_Node_Str"),false));
  }
  Display.getDefault().asyncExec(new Runnable(){
    public void run(){
      ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
    }
  }
);
  CorePlugin.getDefault().refreshDQView(RepositoryNodeHelper.getLibrariesFolderNode(EResourceConstant.USER_DEFINED_INDICATORS));
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importIndicatorToStucture(file,folder,page.getSkip(),page.getRename());
  if (information.isEmpty()) {
    information.add(new ReturnCode(DefaultMessagesImpl.getString("String_Node_Str"),false));
  }
  Display.getDefault().asyncExec(new Runnable(){
    public void run(){
      ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
    }
  }
);
  CorePlugin.getDefault().refreshDQView(RepositoryNodeHelper.getLibrariesFolderNode(EResourceConstant.USER_DEFINED_INDICATORS));
  return true;
}
Program: 138035
Project: 138035
Buggy source:
public void run(){
  ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}

Fixed version (ground truth):
public void run(){
  ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}
Program: 138036
Project: 138036
Buggy source:
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importParserRuleToStucture(file,folder,page.getSkip(),page.getRename());
  if (0 < information.size()) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
      }
    }
);
    CorePlugin.getDefault().refreshDQView(RepositoryNodeHelper.getLibrariesFolderNode(EResourceConstant.RULES_PARSER));
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importParserRuleToStucture(file,folder,page.getSkip(),page.getRename());
  if (0 < information.size()) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
      }
    }
);
    CorePlugin.getDefault().refreshDQView(RepositoryNodeHelper.getLibrariesFolderNode(EResourceConstant.RULES_PARSER));
  }
  return true;
}
Program: 138037
Project: 138037
Buggy source:
public void run(IIntroSite site,Properties params){
  PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro());
  run();
}

Fixed version (ground truth):
public void run(IIntroSite site,Properties params){
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    MessageDialog.openWarning(null,"String_Node_Str","String_Node_Str");
  }
 else {
    PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro());
    IWorkbenchWindow workbenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (null == workbenchWindow) {
      return;
    }
    IWorkbenchPage workbenchPage=workbenchWindow.getActivePage();
    if (null == workbenchPage) {
      return;
    }
    IPerspectiveDescriptor currentPerspective=workbenchPage.getPerspective();
    if (!IBrandingConfiguration.PERSPECTIVE_DQ_ID.equals(currentPerspective.getId())) {
      try {
        workbenchWindow.getWorkbench().showPerspective(IBrandingConfiguration.PERSPECTIVE_DQ_ID,workbenchWindow);
        workbenchPage=workbenchWindow.getActivePage();
      }
 catch (      WorkbenchException e) {
        ExceptionHandler.process(e);
        return;
      }
    }
    run();
  }
}
Program: 138040
Project: 138040
Buggy source:
public void run(){
  ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}

Fixed version (ground truth):
public void run(){
  ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}
Program: 138041
Project: 138041
Buggy source:
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importToStucture(file,folder,type,page.getSkip(),page.getRename());
  if (0 < information.size()) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
      }
    }
);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importToStucture(file,folder,type,page.getSkip(),page.getRename());
  if (0 < information.size()) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
      }
    }
);
  }
  return true;
}
Program: 138042
Project: 138042
Buggy source:
private void updateUI(IJobChangeEvent event){
  final List<ReturnCode> information=new ArrayList<ReturnCode>();
  setEnabled(true);
  if (fExtensionDownloaded > 0) {
    for (    IEcosComponent componet : fInstalledComponents) {
      List<File> validFiles=extractFiles(componet,information);
      if (!validFiles.isEmpty()) {
        String categoryName=componet.getCategry().getName();
        EEcosCategory ecosCategory=EEcosCategory.getEcosCategory(categoryName);
        if (ecosCategory != null) {
          EResourceConstant resourceType=ecosCategory.getResource();
          for (          File oneFile : validFiles) {
            information.addAll(ImportFactory.doInport(resourceType,oneFile,componet.getName()));
          }
        }
      }
    }
    if (information.isEmpty()) {
      information.add(new ReturnCode(DefaultMessagesImpl.getString("String_Node_Str"),false));
    }
    ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
    CorePlugin.getDefault().refreshDQView();
  }
}

Fixed version (ground truth):
private void updateUI(IJobChangeEvent event){
  final List<ReturnCode> information=new ArrayList<ReturnCode>();
  setEnabled(true);
  if (fExtensionDownloaded > 0) {
    for (    IEcosComponent componet : fInstalledComponents) {
      List<File> validFiles=extractFiles(componet,information);
      if (!validFiles.isEmpty()) {
        String categoryName=componet.getCategry().getName();
        EEcosCategory ecosCategory=EEcosCategory.getEcosCategory(categoryName);
        if (ecosCategory != null) {
          EResourceConstant resourceType=ecosCategory.getResource();
          for (          File oneFile : validFiles) {
            information.addAll(ImportFactory.doInport(resourceType,oneFile,componet.getName()));
          }
        }
      }
    }
    if (information.isEmpty()) {
      information.add(new ReturnCode(DefaultMessagesImpl.getString("String_Node_Str"),false));
    }
    ImportInfoDialog.openImportInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
    CorePlugin.getDefault().refreshDQView();
  }
}
Program: 138043
Project: 138043
Buggy source:
public void run(){
  ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}

Fixed version (ground truth):
public void run(){
  ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
}
Program: 138044
Project: 138044
Buggy source:
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importIndicatorToStucture(file,folder,page.getSkip(),page.getRename());
  if (information.isEmpty()) {
    information.add(new ReturnCode(DefaultMessagesImpl.getString("String_Node_Str"),false));
  }
  Display.getDefault().asyncExec(new Runnable(){
    public void run(){
      ImportInfoDialog.openImportInformation(null,DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
    }
  }
);
  CorePlugin.getDefault().refreshDQView(RepositoryNodeHelper.getLibrariesFolderNode(EResourceConstant.USER_DEFINED_INDICATORS));
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (IMessageProvider.WARNING == page.getMessageType()) {
    if (!MessageDialog.openConfirm(null,DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"))) {
      return false;
    }
  }
  File file=new File(page.getSourceFile());
  final List<ReturnCode> information=ImportFactory.importIndicatorToStucture(file,folder,page.getSkip(),page.getRename());
  if (information.isEmpty()) {
    information.add(new ReturnCode(DefaultMessagesImpl.getString("String_Node_Str"),false));
  }
  Display.getDefault().asyncExec(new Runnable(){
    public void run(){
      ImportInfoDialog.openImportInformation(getShell(),DefaultMessagesImpl.getString("String_Node_Str"),(ReturnCode[])information.toArray(new ReturnCode[0]));
    }
  }
);
  CorePlugin.getDefault().refreshDQView(RepositoryNodeHelper.getLibrariesFolderNode(EResourceConstant.USER_DEFINED_INDICATORS));
  return true;
}
Program: 138048
Project: 138048
Buggy source:
@Override protected ModelElementIndicator[] getPredefinedColumnIndicator(){
  IndicatorEnum[] allwedEnumes=new IndicatorEnum[5];
  allwedEnumes[0]=IndicatorEnum.CountsIndicatorEnum;
  allwedEnumes[1]=IndicatorEnum.MinValueIndicatorEnum;
  allwedEnumes[2]=IndicatorEnum.MaxValueIndicatorEnum;
  allwedEnumes[3]=IndicatorEnum.LowFrequencyIndicatorEnum;
  allwedEnumes[4]=IndicatorEnum.FrequencyIndicatorEnum;
  ModelElementIndicator[] returnColumnIndicator=composePredefinedColumnIndicator(allwedEnumes);
  if (parameters != null) {
    for (    ModelElementIndicator columnIndicator : returnColumnIndicator) {
      for (      Indicator indicator : columnIndicator.getIndicators()) {
        if (indicator instanceof FrequencyIndicator) {
          indicator.getParameters().getDateParameters().setDateAggregationType(parameters.getDateParameters().getDateAggregationType());
        }
      }
    }
  }
  return returnColumnIndicator;
}

Fixed version (ground truth):
@Override protected ModelElementIndicator[] getPredefinedColumnIndicator(){
  int count=5;
  if (isTimeType()) {
    count=3;
  }
  IndicatorEnum[] allwedEnumes=new IndicatorEnum[count];
  allwedEnumes[0]=IndicatorEnum.CountsIndicatorEnum;
  allwedEnumes[1]=IndicatorEnum.MinValueIndicatorEnum;
  allwedEnumes[2]=IndicatorEnum.MaxValueIndicatorEnum;
  if (count == 5) {
    allwedEnumes[3]=IndicatorEnum.LowFrequencyIndicatorEnum;
    allwedEnumes[4]=IndicatorEnum.FrequencyIndicatorEnum;
  }
  ModelElementIndicator[] returnColumnIndicator=composePredefinedColumnIndicator(allwedEnumes);
  if (parameters != null) {
    for (    ModelElementIndicator columnIndicator : returnColumnIndicator) {
      for (      Indicator indicator : columnIndicator.getIndicators()) {
        if (indicator instanceof FrequencyIndicator) {
          indicator.getParameters().getDateParameters().setDateAggregationType(parameters.getDateParameters().getDateAggregationType());
        }
      }
    }
  }
  return returnColumnIndicator;
}
Program: 138049
Project: 138049
Buggy source:
@Override protected void handleAddElement(ModelElementChangeRightTarget addElement){
  EObject rightElement=addElement.getRightElement();
  Catalog catalog=SwitchHelpers.CATALOG_SWITCH.doSwitch(rightElement);
  if (catalog != null) {
    ConnectionHelper.addCatalog(catalog,oldDataProvider);
    this.tempReloadProvider.getDataPackage().remove(catalog);
  }
 else {
    Schema schema=SwitchHelpers.SCHEMA_SWITCH.doSwitch(rightElement);
    if (schema != null) {
      EObject eContainer=schema.eContainer();
      if (eContainer != null && eContainer instanceof Catalog) {
        Catalog schemaParent=(Catalog)eContainer;
        List<Schema> schemas=new ArrayList<Schema>();
        schemas.add(schema);
        Catalog oldCatalog=CatalogHelper.getCatalog(oldDataProvider,schemaParent.getName());
        if (oldCatalog != null) {
          CatalogHelper.addSchemas(schemas,oldCatalog);
          schemaParent.getOwnedElement().remove(schema);
        }
      }
 else {
        ConnectionHelper.addSchema(schema,oldDataProvider);
        this.tempReloadProvider.getDataPackage().remove(catalog);
      }
    }
  }
  return;
}

Fixed version (ground truth):
@Override protected void handleAddElement(ModelElementChangeRightTarget addElement){
  EObject rightElement=addElement.getRightElement();
  Catalog catalog=SwitchHelpers.CATALOG_SWITCH.doSwitch(rightElement);
  if (catalog != null) {
    catalog.getDataManager().clear();
    ConnectionHelper.addCatalog(catalog,oldDataProvider);
    this.tempReloadProvider.getDataPackage().remove(catalog);
  }
 else {
    Schema schema=SwitchHelpers.SCHEMA_SWITCH.doSwitch(rightElement);
    if (schema != null) {
      EObject eContainer=schema.eContainer();
      if (eContainer != null && eContainer instanceof Catalog) {
        Catalog schemaParent=(Catalog)eContainer;
        List<Schema> schemas=new ArrayList<Schema>();
        schemas.add(schema);
        Catalog oldCatalog=CatalogHelper.getCatalog(oldDataProvider,schemaParent.getName());
        if (oldCatalog != null) {
          CatalogHelper.addSchemas(schemas,oldCatalog);
          schemaParent.getOwnedElement().remove(schema);
        }
      }
 else {
        schema.getDataManager().clear();
        ConnectionHelper.addSchema(schema,oldDataProvider);
        this.tempReloadProvider.getDataPackage().remove(catalog);
      }
    }
  }
  return;
}
Program: 138050
Project: 138050
Buggy source:
public ChangeConnectionAction(Connection oldDataProvider,Connection newDataProvider,Analysis analysis){
  this.oldDataProvider=oldDataProvider;
  this.newDataProvider=newDataProvider;
  this.synAnalysis=analysis;
  changeActionStatus=new ReturnCode(Boolean.FALSE);
}

Fixed version (ground truth):
public ChangeConnectionAction(Connection oldDataProvider,Connection newDataProvider,Analysis analysis){
  this.oldDataProvider=oldDataProvider;
  this.newDataProvider=newDataProvider;
  this.synAnalysis=analysis;
  this.changeActionStatus=new ReturnCode(Boolean.FALSE);
}
Program: 138051
Project: 138051
Buggy source:
public IFile duplicate(String newLabel){
  if (modelElement != null) {
    ModelElement newObject=(ModelElement)EMFSharedResources.getInstance().copyEObject(modelElement);
    newObject.setName(newLabel);
    IFolder folder=extractFolder(modelElement);
    if (folder != null) {
      newObject=update(modelElement,newObject);
      AElementPersistance elementWriter=ElementWriterFactory.getInstance().create(modelElement);
      if (elementWriter != null) {
        elementWriter.create(newObject,folder);
        for (        Dependency dependency : modelElement.getClientDependency()) {
          for (          ModelElement supplyier : dependency.getSupplier()) {
            TypedReturnCode<Dependency> rc=DependenciesHandler.getInstance().setUsageDependencyOn(newObject,supplyier);
            EMFSharedResources.getInstance().saveResource(rc.getObject().eResource());
          }
        }
        URI uri;
        if (newObject.eIsProxy()) {
          uri=((InternalEObject)newObject).eProxyURI();
        }
 else {
          uri=newObject.eResource().getURI();
        }
        return ResourceManager.getRoot().getFile(new Path(uri.toPlatformString(false)));
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public IFile duplicate(String newLabel){
  if (modelElement != null) {
    ModelElement newObject=(ModelElement)EMFSharedResources.getInstance().copyEObject(modelElement);
    newObject.setName(newLabel);
    if (newObject instanceof AbstractMetadataObject) {
      AbstractMetadataObject amObj=(AbstractMetadataObject)newObject;
      amObj.setLabel(newLabel);
    }
    IFolder folder=extractFolder(modelElement);
    if (folder != null) {
      newObject=update(modelElement,newObject);
      AElementPersistance elementWriter=ElementWriterFactory.getInstance().create(modelElement);
      if (elementWriter != null) {
        elementWriter.create(newObject,folder);
        for (        Dependency dependency : modelElement.getClientDependency()) {
          for (          ModelElement supplyier : dependency.getSupplier()) {
            TypedReturnCode<Dependency> rc=DependenciesHandler.getInstance().setUsageDependencyOn(newObject,supplyier);
            EMFSharedResources.getInstance().saveResource(rc.getObject().eResource());
          }
        }
        URI uri;
        if (newObject.eIsProxy()) {
          uri=((InternalEObject)newObject).eProxyURI();
        }
 else {
          uri=newObject.eResource().getURI();
        }
        return ResourceManager.getRoot().getFile(new Path(uri.toPlatformString(false)));
      }
    }
  }
  return null;
}
Program: 138053
Project: 138053
Buggy source:
@Override protected void handleAddElement(ModelElementChangeRightTarget addElement){
  EObject rightElement=addElement.getRightElement();
  Catalog catalog=SwitchHelpers.CATALOG_SWITCH.doSwitch(rightElement);
  if (catalog != null) {
    ConnectionHelper.addCatalog(catalog,oldDataProvider);
    this.tempReloadProvider.getDataPackage().remove(catalog);
  }
 else {
    Schema schema=SwitchHelpers.SCHEMA_SWITCH.doSwitch(rightElement);
    if (schema != null) {
      EObject eContainer=schema.eContainer();
      if (eContainer != null && eContainer instanceof Catalog) {
        Catalog schemaParent=(Catalog)eContainer;
        List<Schema> schemas=new ArrayList<Schema>();
        schemas.add(schema);
        Catalog oldCatalog=CatalogHelper.getCatalog(oldDataProvider,schemaParent.getName());
        if (oldCatalog != null) {
          CatalogHelper.addSchemas(schemas,oldCatalog);
          schemaParent.getOwnedElement().remove(schema);
        }
      }
 else {
        ConnectionHelper.addSchema(schema,oldDataProvider);
        this.tempReloadProvider.getDataPackage().remove(catalog);
      }
    }
  }
  return;
}

Fixed version (ground truth):
@Override protected void handleAddElement(ModelElementChangeRightTarget addElement){
  EObject rightElement=addElement.getRightElement();
  Catalog catalog=SwitchHelpers.CATALOG_SWITCH.doSwitch(rightElement);
  if (catalog != null) {
    catalog.getDataManager().clear();
    ConnectionHelper.addCatalog(catalog,oldDataProvider);
    this.tempReloadProvider.getDataPackage().remove(catalog);
  }
 else {
    Schema schema=SwitchHelpers.SCHEMA_SWITCH.doSwitch(rightElement);
    if (schema != null) {
      EObject eContainer=schema.eContainer();
      if (eContainer != null && eContainer instanceof Catalog) {
        Catalog schemaParent=(Catalog)eContainer;
        List<Schema> schemas=new ArrayList<Schema>();
        schemas.add(schema);
        Catalog oldCatalog=CatalogHelper.getCatalog(oldDataProvider,schemaParent.getName());
        if (oldCatalog != null) {
          CatalogHelper.addSchemas(schemas,oldCatalog);
          schemaParent.getOwnedElement().remove(schema);
        }
      }
 else {
        schema.getDataManager().clear();
        ConnectionHelper.addSchema(schema,oldDataProvider);
        this.tempReloadProvider.getDataPackage().remove(catalog);
      }
    }
  }
  return;
}
Program: 138054
Project: 138054
Buggy source:
public ChangeConnectionAction(Connection oldDataProvider,Connection newDataProvider,Analysis analysis){
  this.oldDataProvider=oldDataProvider;
  this.newDataProvider=newDataProvider;
  this.synAnalysis=analysis;
  changeActionStatus=new ReturnCode(Boolean.FALSE);
}

Fixed version (ground truth):
public ChangeConnectionAction(Connection oldDataProvider,Connection newDataProvider,Analysis analysis){
  this.oldDataProvider=oldDataProvider;
  this.newDataProvider=newDataProvider;
  this.synAnalysis=analysis;
  this.changeActionStatus=new ReturnCode(Boolean.FALSE);
}
Program: 138055
Project: 138055
Buggy source:
public IFile duplicate(String newLabel){
  if (modelElement != null) {
    ModelElement newObject=(ModelElement)EMFSharedResources.getInstance().copyEObject(modelElement);
    newObject.setName(newLabel);
    IFolder folder=extractFolder(modelElement);
    if (folder != null) {
      newObject=update(modelElement,newObject);
      AElementPersistance elementWriter=ElementWriterFactory.getInstance().create(modelElement);
      if (elementWriter != null) {
        elementWriter.create(newObject,folder);
        for (        Dependency dependency : modelElement.getClientDependency()) {
          for (          ModelElement supplyier : dependency.getSupplier()) {
            TypedReturnCode<Dependency> rc=DependenciesHandler.getInstance().setUsageDependencyOn(newObject,supplyier);
            EMFSharedResources.getInstance().saveResource(rc.getObject().eResource());
          }
        }
        URI uri;
        if (newObject.eIsProxy()) {
          uri=((InternalEObject)newObject).eProxyURI();
        }
 else {
          uri=newObject.eResource().getURI();
        }
        return ResourceManager.getRoot().getFile(new Path(uri.toPlatformString(false)));
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public IFile duplicate(String newLabel){
  if (modelElement != null) {
    ModelElement newObject=(ModelElement)EMFSharedResources.getInstance().copyEObject(modelElement);
    newObject.setName(newLabel);
    if (newObject instanceof AbstractMetadataObject) {
      AbstractMetadataObject amObj=(AbstractMetadataObject)newObject;
      amObj.setLabel(newLabel);
    }
    IFolder folder=extractFolder(modelElement);
    if (folder != null) {
      newObject=update(modelElement,newObject);
      AElementPersistance elementWriter=ElementWriterFactory.getInstance().create(modelElement);
      if (elementWriter != null) {
        elementWriter.create(newObject,folder);
        for (        Dependency dependency : modelElement.getClientDependency()) {
          for (          ModelElement supplyier : dependency.getSupplier()) {
            TypedReturnCode<Dependency> rc=DependenciesHandler.getInstance().setUsageDependencyOn(newObject,supplyier);
            EMFSharedResources.getInstance().saveResource(rc.getObject().eResource());
          }
        }
        URI uri;
        if (newObject.eIsProxy()) {
          uri=((InternalEObject)newObject).eProxyURI();
        }
 else {
          uri=newObject.eResource().getURI();
        }
        return ResourceManager.getRoot().getFile(new Path(uri.toPlatformString(false)));
      }
    }
  }
  return null;
}
Program: 138057
Project: 138057
Buggy source:
/** 
 * DOC xqliu Comment method "createIndicatorUnit".
 * @param fe
 * @param tableIndicator
 * @param analysis
 * @return
 */
public static TableIndicatorUnit createIndicatorUnit(IFile fe,TableIndicator tableIndicator,Analysis analysis){
  WhereRule whereRule=DQRuleResourceFileHelper.getInstance().findWhereRule(fe);
  for (  Indicator indicator : tableIndicator.getIndicators()) {
    if (whereRule.getName().equals(indicator.getName())) {
      return null;
    }
  }
  WhereRuleIndicator wrIndicator=IndicatorSqlFactory.eINSTANCE.createWhereRuleIndicator();
  wrIndicator.setAnalyzedElement(tableIndicator.getColumnSet());
  wrIndicator.setIndicatorDefinition(whereRule);
  IndicatorEnum type=IndicatorEnum.findIndicatorEnum(wrIndicator.eClass());
  TableIndicatorUnit addIndicatorUnit=tableIndicator.addSpecialIndicator(fe,type,wrIndicator);
  DependenciesHandler.getInstance().setUsageDependencyOn(analysis,whereRule);
  return addIndicatorUnit;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "createIndicatorUnit".
 * @param fe
 * @param tableIndicator
 * @param analysis
 * @return
 */
public static TableIndicatorUnit createIndicatorUnit(IFile fe,TableIndicator tableIndicator,Analysis analysis){
  WhereRule whereRule=DQRuleResourceFileHelper.getInstance().findWhereRule(fe);
  for (  Indicator indicator : tableIndicator.getIndicators()) {
    if (whereRule.getName().equals(indicator.getName())) {
      return null;
    }
  }
  WhereRuleIndicator[] compositeWhereRuleIndicator=createCompositeWhereRuleIndicator(tableIndicator.getColumnSet(),whereRule);
  IndicatorEnum type=IndicatorEnum.findIndicatorEnum(compositeWhereRuleIndicator[0].eClass());
  TableIndicatorUnit addIndicatorUnit=tableIndicator.addSpecialIndicator(fe,type,compositeWhereRuleIndicator[0]);
  DependenciesHandler.getInstance().setUsageDependencyOn(analysis,whereRule);
  IndicatorEnum whereRuleAidType=IndicatorEnum.findIndicatorEnum(compositeWhereRuleIndicator[1].eClass());
  tableIndicator.addSpecialIndicator(fe,whereRuleAidType,compositeWhereRuleIndicator[1]);
  return addIndicatorUnit;
}
Program: 138058
Project: 138058
Buggy source:
public void dropWhereRules(Object data,List<IFile> files,int index,TreeItem item){
  TreeItem treeItem=null;
  if (item == null) {
    if (getTree().getItemCount() > 0) {
      treeItem=getTree().getItem(0);
    }
  }
 else {
    treeItem=item;
  }
  if (data != null && treeItem != null && files.size() > 0) {
    Analysis analysis=getAnalysis();
    for (    IFile file : files) {
      TableIndicatorUnit addIndicatorUnit=DQRuleUtilities.createIndicatorUnit(file,(TableIndicator)data,analysis);
      if (addIndicatorUnit != null) {
        createOneUnit(treeItem,addIndicatorUnit);
        setDirty(true);
      }
      TableIndicatorUnit addIndicatorAideUnit=DQRuleUtilities.createIndicatorAideUnit(file,(TableIndicator)data,analysis);
      if (addIndicatorUnit != null) {
        setDirty(true);
      }
 else {
        log.error("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void dropWhereRules(Object data,List<IFile> files,int index,TreeItem item){
  TreeItem treeItem=null;
  if (item == null) {
    if (getTree().getItemCount() > 0) {
      treeItem=getTree().getItem(0);
    }
  }
 else {
    treeItem=item;
  }
  if (data != null && treeItem != null && files.size() > 0) {
    Analysis analysis=getAnalysis();
    for (    IFile file : files) {
      TableIndicatorUnit addIndicatorUnit=DQRuleUtilities.createIndicatorUnit(file,(TableIndicator)data,analysis);
      if (addIndicatorUnit != null) {
        createOneUnit(treeItem,addIndicatorUnit);
        setDirty(true);
      }
    }
  }
}
Program: 138059
Project: 138059
Buggy source:
@Override public ModelElement initCWMResourceBuilder(){
  Analysis analysis=(Analysis)super.initCWMResourceBuilder();
  NamedColumnSet[] ncss=getNamedColumnSet();
  Connection tdp=getTdDataProvider();
  if (ncss != null && getAnalysisBuilder() != null) {
    List<Indicator> indicatorList=new ArrayList<Indicator>();
    WhereRule[] whereRules=getWhereRules(dqruleSelectPage.getCViewer().getCheckedElements());
    for (    NamedColumnSet ncs : ncss) {
      RowCountIndicator rowCountIndicator=IndicatorsFactory.eINSTANCE.createRowCountIndicator();
      DefinitionHandler.getInstance().setDefaultIndicatorDefinition(rowCountIndicator);
      rowCountIndicator.setAnalyzedElement(ncs);
      indicatorList.add(rowCountIndicator);
      if (whereRules != null) {
        for (        WhereRule whereRule : whereRules) {
          WhereRuleIndicator wrIndicator=IndicatorSqlFactory.eINSTANCE.createWhereRuleIndicator();
          wrIndicator.setAnalyzedElement(ncs);
          wrIndicator.setIndicatorDefinition(whereRule);
          indicatorList.add(wrIndicator);
          WhereRuleAideIndicator wraIndicator=IndicatorSqlFactory.eINSTANCE.createWhereRuleAideIndicator();
          wraIndicator.setAnalyzedElement(wrIndicator.getAnalyzedElement());
          wraIndicator.setIndicatorDefinition(wrIndicator.getIndicatorDefinition());
          indicatorList.add(wraIndicator);
        }
      }
    }
    getAnalysisBuilder().addElementsToAnalyze(ncss,indicatorList.toArray(new Indicator[indicatorList.size()]));
    getAnalysisBuilder().setAnalysisConnection(tdp);
  }
  return analysis;
}

Fixed version (ground truth):
@Override public ModelElement initCWMResourceBuilder(){
  Analysis analysis=(Analysis)super.initCWMResourceBuilder();
  NamedColumnSet[] ncss=getNamedColumnSet();
  Connection tdp=getTdDataProvider();
  if (ncss != null && getAnalysisBuilder() != null) {
    List<Indicator> indicatorList=new ArrayList<Indicator>();
    WhereRule[] whereRules=getWhereRules(dqruleSelectPage.getCViewer().getCheckedElements());
    for (    NamedColumnSet ncs : ncss) {
      RowCountIndicator rowCountIndicator=IndicatorsFactory.eINSTANCE.createRowCountIndicator();
      DefinitionHandler.getInstance().setDefaultIndicatorDefinition(rowCountIndicator);
      rowCountIndicator.setAnalyzedElement(ncs);
      indicatorList.add(rowCountIndicator);
      if (whereRules != null) {
        for (        WhereRule whereRule : whereRules) {
          WhereRuleIndicator[] compositeWhereRuleIndicator=DQRuleUtilities.createCompositeWhereRuleIndicator(ncs,whereRule);
          indicatorList.addAll(Arrays.asList(compositeWhereRuleIndicator));
        }
      }
    }
    getAnalysisBuilder().addElementsToAnalyze(ncss,indicatorList.toArray(new Indicator[indicatorList.size()]));
    getAnalysisBuilder().setAnalysisConnection(tdp);
  }
  return analysis;
}
Program: 138060
Project: 138060
Buggy source:
private void computeRepNodeType(IRepositoryNode[] selectedRepositoryNodes,IRepositoryNode targetNode) throws PersistenceException {
  if (selectedRepositoryNodes != null) {
    for (    IRepositoryNode sourceNode : selectedRepositoryNodes) {
      if (targetNode == sourceNode.getParent()) {
        return;
      }
      if (isSameType(sourceNode,targetNode)) {
        if (sourceNode.getType() == ENodeType.REPOSITORY_ELEMENT) {
          if (sourceNode instanceof AnalysisRepNode) {
            moveAnalysisRepNode(sourceNode,targetNode);
          }
 else           if (sourceNode instanceof ReportRepNode) {
            moveReportRepNode(sourceNode,targetNode);
          }
 else           if (sourceNode instanceof DBConnectionRepNode) {
            moveConnectionRepNode(sourceNode,targetNode);
          }
 else           if (sourceNode instanceof SysIndicatorDefinitionRepNode) {
            if (!((SysIndicatorDefinitionRepNode)sourceNode).isSystemIndicator()) {
              moveUDIRepNode(sourceNode,targetNode);
            }
          }
 else           if (sourceNode instanceof PatternRepNode) {
            movePatternRepNode(sourceNode,targetNode);
          }
 else {
            moveCommonRepNode(sourceNode,targetNode);
          }
        }
 else         if (sourceNode.getType() == ENodeType.SIMPLE_FOLDER) {
          moveFolderRepNode(sourceNode,targetNode);
        }
        closeEditorIfOpened(sourceNode);
      }
    }
  }
}

Fixed version (ground truth):
private void computeRepNodeType(IRepositoryNode[] selectedRepositoryNodes,IRepositoryNode targetNode) throws PersistenceException {
  if (selectedRepositoryNodes != null) {
    for (    IRepositoryNode sourceNode : selectedRepositoryNodes) {
      if (targetNode == sourceNode.getParent()) {
        continue;
      }
      if (isSameType(sourceNode,targetNode)) {
        if (sourceNode.getType() == ENodeType.REPOSITORY_ELEMENT) {
          if (sourceNode instanceof AnalysisRepNode) {
            moveAnalysisRepNode(sourceNode,targetNode);
          }
 else           if (sourceNode instanceof ReportRepNode) {
            moveReportRepNode(sourceNode,targetNode);
          }
 else           if (sourceNode instanceof DBConnectionRepNode) {
            moveConnectionRepNode(sourceNode,targetNode);
          }
 else           if (sourceNode instanceof SysIndicatorDefinitionRepNode) {
            if (!((SysIndicatorDefinitionRepNode)sourceNode).isSystemIndicator()) {
              moveUDIRepNode(sourceNode,targetNode);
            }
          }
 else           if (sourceNode instanceof PatternRepNode) {
            movePatternRepNode(sourceNode,targetNode);
          }
 else {
            moveCommonRepNode(sourceNode,targetNode);
          }
        }
 else         if (sourceNode.getType() == ENodeType.SIMPLE_FOLDER) {
          moveFolderRepNode(sourceNode,targetNode);
        }
        closeEditorIfOpened(sourceNode);
        CorePlugin.getDefault().refreshDQView(sourceNode.getParent());
      }
    }
  }
}
Program: 138061
Project: 138061
Buggy source:
@Override public IStatus handleDrop(CommonDropAdapter aDropAdapter,DropTargetEvent aDropTargetEvent,Object aTarget){
  IRepositoryNode targetNode=null;
  try {
    IRepositoryNode[] selectedRepositoryNodes=null;
    targetNode=(IRepositoryNode)aTarget;
    if (aDropAdapter.getCurrentTarget() == null || aDropTargetEvent.data == null) {
      return Status.CANCEL_STATUS;
    }
    TransferData currentTransfer=aDropAdapter.getCurrentTransfer();
    if (LocalSelectionTransfer.getTransfer().isSupportedType(currentTransfer)) {
      selectedRepositoryNodes=getSelectedRepositoryNodes();
    }
    computeRepNodeType(selectedRepositoryNodes,targetNode);
    if (DQRepositoryNode.isOnFilterring()) {
      RepositoryNodeHelper.fillTreeList(null);
      RepositoryNodeHelper.setFilteredNode(RepositoryNodeHelper.getRootNode(ERepositoryObjectType.TDQ_DATA_PROFILING,true));
    }
  }
 catch (  PersistenceException e) {
    e.printStackTrace();
  }
  ProxyRepositoryManager.getInstance().refresh();
  if (targetNode != null) {
    CorePlugin.getDefault().refreshDQView(RepositoryNodeHelper.getRootNode(targetNode.getObjectType()));
  }
 else {
    CorePlugin.getDefault().refreshDQView();
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override public IStatus handleDrop(CommonDropAdapter aDropAdapter,DropTargetEvent aDropTargetEvent,Object aTarget){
  IRepositoryNode targetNode=null;
  try {
    IRepositoryNode[] selectedRepositoryNodes=null;
    targetNode=(IRepositoryNode)aTarget;
    if (aDropAdapter.getCurrentTarget() == null || aDropTargetEvent.data == null) {
      return Status.CANCEL_STATUS;
    }
    TransferData currentTransfer=aDropAdapter.getCurrentTransfer();
    if (LocalSelectionTransfer.getTransfer().isSupportedType(currentTransfer)) {
      selectedRepositoryNodes=getSelectedRepositoryNodes();
    }
    computeRepNodeType(selectedRepositoryNodes,targetNode);
    if (DQRepositoryNode.isOnFilterring()) {
      RepositoryNodeHelper.fillTreeList(null);
      RepositoryNodeHelper.setFilteredNode(RepositoryNodeHelper.getRootNode(ERepositoryObjectType.TDQ_DATA_PROFILING,true));
    }
  }
 catch (  PersistenceException e) {
    e.printStackTrace();
  }
  ProxyRepositoryManager.getInstance().refresh();
  return Status.OK_STATUS;
}
Program: 138064
Project: 138064
Buggy source:
/** 
 * ADD mzhao 2009-05-05 bug:6587.
 */
protected void updateBindConnection(AbstractAnalysisMetadataPage masterPage,List<TableViewer> tableViewerPosStack){
  boolean isEmpty1=tableViewerPosStack.get(0) == null || tableViewerPosStack.get(0).getInput() == null || ((List<TdColumn>)tableViewerPosStack.get(0).getInput()).size() == 0;
  boolean isEmpty2=tableViewerPosStack.get(1) == null || tableViewerPosStack.get(1).getInput() == null || ((List<TdColumn>)tableViewerPosStack.get(1).getInput()).size() == 0;
  if (isEmpty1 && isEmpty2) {
    return;
  }
 else {
    TableViewer columnsElementViewer=null;
    if (!isEmpty1) {
      columnsElementViewer=tableViewerPosStack.get(0);
    }
 else {
      columnsElementViewer=tableViewerPosStack.get(1);
    }
    Connection tdProvider=null;
    Object input=columnsElementViewer.getInput();
    List<DBColumnRepNode> columnSet=(List<DBColumnRepNode>)input;
    if (columnSet != null && columnSet.size() != 0) {
      TdColumn column=(TdColumn)((MetadataColumnRepositoryObject)columnSet.get(0).getObject()).getTdColumn();
      if (column != null && column.eIsProxy()) {
        column=(TdColumn)EObjectHelper.resolveObject(column);
      }
      tdProvider=ConnectionHelper.getTdDataProvider(column);
      setConnectionState(masterPage,tdProvider);
    }
  }
}

Fixed version (ground truth):
/** 
 * ADD mzhao 2009-05-05 bug:6587.
 */
protected void updateBindConnection(AbstractAnalysisMetadataPage masterPage,List<TableViewer> tableViewerPosStack){
  boolean isEmpty1=tableViewerPosStack.get(0) == null || tableViewerPosStack.get(0).getInput() == null || ((List)tableViewerPosStack.get(0).getInput()).size() == 0;
  boolean isEmpty2=tableViewerPosStack.get(1) == null || tableViewerPosStack.get(1).getInput() == null || ((List)tableViewerPosStack.get(1).getInput()).size() == 0;
  if (isEmpty1 && isEmpty2) {
    return;
  }
 else {
    TableViewer columnsElementViewer=null;
    if (!isEmpty1) {
      columnsElementViewer=tableViewerPosStack.get(0);
    }
 else {
      columnsElementViewer=tableViewerPosStack.get(1);
    }
    Connection tdProvider=null;
    Object input=columnsElementViewer.getInput();
    List<DBColumnRepNode> columnSet=(List<DBColumnRepNode>)input;
    if (columnSet != null && columnSet.size() != 0) {
      TdColumn column=(TdColumn)((MetadataColumnRepositoryObject)columnSet.get(0).getObject()).getTdColumn();
      if (column != null && column.eIsProxy()) {
        column=(TdColumn)EObjectHelper.resolveObject(column);
      }
      tdProvider=ConnectionHelper.getTdDataProvider(column);
      setConnectionState(masterPage,tdProvider);
    }
  }
}