nus-yam/ex-repair huggingface dataset:
Program: 127330
Project: 127330
Buggy source:
@Override public void dragStart(DragSourceEvent event){
  ISelection selection=RepoViewCommonViewer.this.getSelection();
  for (  Object obj : ((StructuredSelection)selection).toArray()) {
    RepositoryNode sourceNode=(RepositoryNode)obj;
    event.doit=MoveObjectAction.getInstance().validateAction(sourceNode,null,true);
  }
  LocalSelectionTransfer.getTransfer().setSelection(selection);
  LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & FFFFFFFFL);
}

Fixed version (ground truth):
@Override public void dragStart(DragSourceEvent event){
  ISelection selection=RepoViewCommonViewer.this.getSelection();
  for (  Object obj : ((StructuredSelection)selection).toArray()) {
    if (obj instanceof RepositoryNode) {
      RepositoryNode sourceNode=(RepositoryNode)obj;
      event.doit=MoveObjectAction.getInstance().validateAction(sourceNode,null,true);
    }
  }
  LocalSelectionTransfer.getTransfer().setSelection(selection);
  LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & FFFFFFFFL);
}
Program: 127331
Project: 127331
Buggy source:
@Override protected void initDragAndDrop(){
  int ops=DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
  Transfer[] transfers=new Transfer[]{LocalSelectionTransfer.getTransfer()};
  this.addDragSupport(ops,transfers,new DragSourceAdapter(){
    private static final long FFFFFFFFL=0xFFFFFFFFL;
    @Override public void dragSetData(    DragSourceEvent event){
      repViewCommonNavigator.setNoNeedUpdate(true);
      event.data=LocalSelectionTransfer.getTransfer().getSelection();
    }
    @Override public void dragStart(    DragSourceEvent event){
      ISelection selection=RepoViewCommonViewer.this.getSelection();
      for (      Object obj : ((StructuredSelection)selection).toArray()) {
        RepositoryNode sourceNode=(RepositoryNode)obj;
        event.doit=MoveObjectAction.getInstance().validateAction(sourceNode,null,true);
      }
      LocalSelectionTransfer.getTransfer().setSelection(selection);
      LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & FFFFFFFFL);
    }
    @Override public void dragFinished(    DragSourceEvent event){
      repViewCommonNavigator.dragFinished();
    }
  }
);
  RepositoryDropAdapter adapter=new RepositoryDropAdapter(this);
  adapter.setFeedbackEnabled(false);
  this.addDropSupport(ops | DND.DROP_DEFAULT,transfers,adapter);
}

Fixed version (ground truth):
@Override protected void initDragAndDrop(){
  int ops=DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
  Transfer[] transfers=new Transfer[]{LocalSelectionTransfer.getTransfer()};
  this.addDragSupport(ops,transfers,new DragSourceAdapter(){
    private static final long FFFFFFFFL=0xFFFFFFFFL;
    @Override public void dragSetData(    DragSourceEvent event){
      repViewCommonNavigator.setNoNeedUpdate(true);
      event.data=LocalSelectionTransfer.getTransfer().getSelection();
    }
    @Override public void dragStart(    DragSourceEvent event){
      ISelection selection=RepoViewCommonViewer.this.getSelection();
      for (      Object obj : ((StructuredSelection)selection).toArray()) {
        if (obj instanceof RepositoryNode) {
          RepositoryNode sourceNode=(RepositoryNode)obj;
          event.doit=MoveObjectAction.getInstance().validateAction(sourceNode,null,true);
        }
      }
      LocalSelectionTransfer.getTransfer().setSelection(selection);
      LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & FFFFFFFFL);
    }
    @Override public void dragFinished(    DragSourceEvent event){
      repViewCommonNavigator.dragFinished();
    }
  }
);
  RepositoryDropAdapter adapter=new RepositoryDropAdapter(this);
  adapter.setFeedbackEnabled(false);
  this.addDropSupport(ops | DND.DROP_DEFAULT,transfers,adapter);
}
Program: 127333
Project: 127333
Buggy source:
@Override public IRepositoryViewObject getLastVersion(Project project,String id,String relativeFolder,ERepositoryObjectType type) throws PersistenceException {
  List<IRepositoryViewObject> serializableAllVersion=null;
  Object fullFolder=getFullFolder(project,type,relativeFolder);
  serializableAllVersion=getSerializableFromFolder(project,fullFolder,id,type,false,false,false,true);
  if (serializableAllVersion.isEmpty()) {
    serializableAllVersion=getSerializable(project,id,true,false);
  }
  int size=serializableAllVersion.size();
  if (size > 1) {
    String message=getItemsMessages(serializableAllVersion,size);
    throw new PersistenceException(Messages.getString("String_Node_Str",message));
  }
 else   if (size == 1) {
    return serializableAllVersion.get(0);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public IRepositoryViewObject getLastVersion(Project project,String id,String relativeFolder,ERepositoryObjectType type) throws PersistenceException {
  List<IRepositoryViewObject> serializableAllVersion=null;
  Object fullFolder=getFullFolder(project,type,relativeFolder);
  serializableAllVersion=getSerializableFromFolder(project,fullFolder,id,type,false,false,true,true);
  if (serializableAllVersion.isEmpty()) {
    serializableAllVersion=getSerializable(project,id,false,false);
  }
  int size=serializableAllVersion.size();
  if (size > 1) {
    String message=getItemsMessages(serializableAllVersion,size);
    throw new PersistenceException(Messages.getString("String_Node_Str",message));
  }
 else   if (size == 1) {
    return serializableAllVersion.get(0);
  }
 else {
    return null;
  }
}
Program: 127340
Project: 127340
Buggy source:
@Override protected void processWhenDispose(){
  if (threadExecutor != null) {
    threadExecutor.clearThreads();
    ExtractMetaDataUtils.closeConnection();
  }
}

Fixed version (ground truth):
@Override protected void processWhenDispose(){
  if (threadExecutor != null) {
    threadExecutor.clearThreads();
    ExtractMetaDataUtils.getInstance().closeConnection();
  }
}
Program: 127341
Project: 127341
Buggy source:
private boolean isOracle(){
  if (this.connectionItem != null) {
    if (this.connectionItem instanceof DatabaseConnectionItem) {
      DatabaseConnectionItem dbConnItem=(DatabaseConnectionItem)this.connectionItem;
      DatabaseConnection dbConn=null;
      String dbtype=null;
      if (dbConnItem.getConnection() instanceof DatabaseConnection) {
        dbConn=(DatabaseConnection)dbConnItem.getConnection();
        dbtype=dbConn.getDatabaseType();
      }
      if (EDatabaseTypeName.ORACLEFORSID.getDisplayName().equals(dbtype) || EDatabaseTypeName.ORACLESN.getDisplayName().equals(dbtype)) {
        return true;
      }
 else       if (EDatabaseTypeName.GENERAL_JDBC.getDisplayName().equals(dbtype)) {
        String driver=dbConn.getDriverClass();
        dbtype=ExtractMetaDataUtils.getDbTypeByClassName(driver);
        if (EDatabaseTypeName.ORACLEFORSID.getDisplayName().equals(dbtype) || EDatabaseTypeName.ORACLESN.getDisplayName().equals(dbtype)) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isOracle(){
  if (this.connectionItem != null) {
    if (this.connectionItem instanceof DatabaseConnectionItem) {
      DatabaseConnectionItem dbConnItem=(DatabaseConnectionItem)this.connectionItem;
      DatabaseConnection dbConn=null;
      String dbtype=null;
      if (dbConnItem.getConnection() instanceof DatabaseConnection) {
        dbConn=(DatabaseConnection)dbConnItem.getConnection();
        dbtype=dbConn.getDatabaseType();
      }
      if (EDatabaseTypeName.ORACLEFORSID.getDisplayName().equals(dbtype) || EDatabaseTypeName.ORACLESN.getDisplayName().equals(dbtype)) {
        return true;
      }
 else       if (EDatabaseTypeName.GENERAL_JDBC.getDisplayName().equals(dbtype)) {
        String driver=dbConn.getDriverClass();
        dbtype=ExtractMetaDataUtils.getInstance().getDbTypeByClassName(driver);
        if (EDatabaseTypeName.ORACLEFORSID.getDisplayName().equals(dbtype) || EDatabaseTypeName.ORACLESN.getDisplayName().equals(dbtype)) {
          return true;
        }
      }
    }
  }
  return false;
}
Program: 127342
Project: 127342
Buggy source:
/** 
 * DOC qzhang Comment method "switchFilter".
 */
private void switchFilter(){
  usedName.setSelection(getTableInfoParameters().isUsedName());
  usedSql.setSelection(!getTableInfoParameters().isUsedName());
  sqlFilter.setEnabled(!getTableInfoParameters().isUsedName());
  sqllabel.setEnabled(!getTableInfoParameters().isUsedName());
  tableCheck.setEnabled(getTableInfoParameters().isUsedName());
  viewCheck.setEnabled(getTableInfoParameters().isUsedName());
  synonymCheck.setEnabled(getTableInfoParameters().isUsedName());
  if (isOracle()) {
    publicSynonymCheck.setEnabled(getTableInfoParameters().isUsedName());
    ExtractMetaDataUtils.setUseAllSynonyms(publicSynonymCheck.getSelection());
  }
  removeButton.setEnabled(getTableInfoParameters().isUsedName());
  editButton.setEnabled(getTableInfoParameters().isUsedName());
  newButton.setEnabled(getTableInfoParameters().isUsedName());
  setNamelabel.setEnabled(getTableInfoParameters().isUsedName());
  nameFilter.setEnabled(getTableInfoParameters().isUsedName());
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "switchFilter".
 */
private void switchFilter(){
  usedName.setSelection(getTableInfoParameters().isUsedName());
  usedSql.setSelection(!getTableInfoParameters().isUsedName());
  sqlFilter.setEnabled(!getTableInfoParameters().isUsedName());
  sqllabel.setEnabled(!getTableInfoParameters().isUsedName());
  tableCheck.setEnabled(getTableInfoParameters().isUsedName());
  viewCheck.setEnabled(getTableInfoParameters().isUsedName());
  synonymCheck.setEnabled(getTableInfoParameters().isUsedName());
  if (isOracle()) {
    publicSynonymCheck.setEnabled(getTableInfoParameters().isUsedName());
    ExtractMetaDataUtils.getInstance().setUseAllSynonyms(publicSynonymCheck.getSelection());
  }
  removeButton.setEnabled(getTableInfoParameters().isUsedName());
  editButton.setEnabled(getTableInfoParameters().isUsedName());
  newButton.setEnabled(getTableInfoParameters().isUsedName());
  setNamelabel.setEnabled(getTableInfoParameters().isUsedName());
  nameFilter.setEnabled(getTableInfoParameters().isUsedName());
}
Program: 127346
Project: 127346
Buggy source:
protected void deleteTable(TableNode tableItem){
  Collection<MetadataTable> tables=new ArrayList<MetadataTable>();
  Iterator<MetadataTable> iterate=ConnectionHelper.getTables(getConnection()).iterator();
  while (iterate.hasNext()) {
    MetadataTable metadata=iterate.next();
    if (metadata != null && metadata.getLabel().equals(tableItem.getValue())) {
      tables.add(metadata);
    }
  }
  TableNode parent=tableItem.getParent();
  String catalog="String_Node_Str";
  String schema="String_Node_Str";
  if (parent != null) {
    if (parent.getType() == TableNode.CATALOG) {
      catalog=parent.getValue();
    }
 else     if (parent.getType() == TableNode.SCHEMA) {
      schema=parent.getValue();
      TableNode catalogNode=parent.getParent();
      if (catalogNode != null) {
        catalog=catalogNode.getValue();
      }
    }
  }
  boolean isAccess=EDatabaseTypeName.ACCESS.getDisplayName().equals(metadataconnection.getDbType());
  if (isAccess) {
    ProjectNodeHelper.removeTablesFromCurrentCatalogOrSchema(catalog,getConnection().getName(),getConnection(),tables);
  }
 else {
    if ("String_Node_Str".equals(schema) && ExtractMetaDataUtils.useAllSynonyms) {
      schema=MetadataConnectionUtils.FAKE_SCHEMA_SYNONYMS;
    }
    ProjectNodeHelper.removeTablesFromCurrentCatalogOrSchema(catalog,schema,getConnection(),tables);
  }
}

Fixed version (ground truth):
protected void deleteTable(TableNode tableItem){
  Collection<MetadataTable> tables=new ArrayList<MetadataTable>();
  Iterator<MetadataTable> iterate=ConnectionHelper.getTables(getConnection()).iterator();
  while (iterate.hasNext()) {
    MetadataTable metadata=iterate.next();
    if (metadata != null && metadata.getLabel().equals(tableItem.getValue())) {
      tables.add(metadata);
    }
  }
  TableNode parent=tableItem.getParent();
  String catalog="String_Node_Str";
  String schema="String_Node_Str";
  if (parent != null) {
    if (parent.getType() == TableNode.CATALOG) {
      catalog=parent.getValue();
    }
 else     if (parent.getType() == TableNode.SCHEMA) {
      schema=parent.getValue();
      TableNode catalogNode=parent.getParent();
      if (catalogNode != null) {
        catalog=catalogNode.getValue();
      }
    }
  }
  boolean isAccess=EDatabaseTypeName.ACCESS.getDisplayName().equals(metadataconnection.getDbType());
  if (isAccess) {
    ProjectNodeHelper.removeTablesFromCurrentCatalogOrSchema(catalog,getConnection().getName(),getConnection(),tables);
  }
 else {
    if ("String_Node_Str".equals(schema) && ExtractMetaDataUtils.getInstance().isUseAllSynonyms()) {
      schema=MetadataConnectionUtils.FAKE_SCHEMA_SYNONYMS;
    }
    ProjectNodeHelper.removeTablesFromCurrentCatalogOrSchema(catalog,schema,getConnection(),tables);
  }
}
Program: 127347
Project: 127347
Buggy source:
@Override protected void processWhenDispose(){
  if (threadExecutor != null) {
    threadExecutor.clearThreads();
    ExtractMetaDataUtils.closeConnection();
  }
}

Fixed version (ground truth):
@Override protected void processWhenDispose(){
  if (threadExecutor != null) {
    threadExecutor.clearThreads();
    ExtractMetaDataUtils.getInstance().closeConnection();
  }
}
Program: 127350
Project: 127350
Buggy source:
public Project getProjectFromProjectLabel(String label){
  if (currentProject.getLabel().equals(label)) {
    return currentProject;
  }
  for (  Project project : getReferencedProjects()) {
    if (project.getLabel().equals(label)) {
      return project;
    }
  }
  return null;
}

Fixed version (ground truth):
public Project getProjectFromProjectLabel(String label){
  if (currentProject.getLabel().equals(label)) {
    return currentProject;
  }
  for (  Project project : getAllReferencedProjects()) {
    if (project.getLabel().equals(label)) {
      return project;
    }
  }
  return null;
}
Program: 127352
Project: 127352
Buggy source:
public static void addTableForSpecifiedDataPackage(DatabaseConnection dbconn,MetadataTable dbtable) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
  IMetadataConnection imetadataConnection=ConvertionHelper.convert(dbconn);
  DatabaseConnection conn=(DatabaseConnection)imetadataConnection.getCurrentConnection();
  Collection<orgomg.cwm.objectmodel.core.Package> newDataPackage=EcoreUtil.copyAll(dbconn.getDataPackage());
  ConnectionHelper.addPackages(newDataPackage,conn);
  String catalog=imetadataConnection.getDatabase();
  String schema="String_Node_Str";
  EObject container=dbtable.eContainer();
  if (container != null) {
    if (container instanceof Schema) {
      schema=((Schema)container).getName();
      EObject c=container.eContainer();
      if (c != null && c instanceof Catalog) {
        catalog=((Catalog)c).getName();
      }
    }
 else     if (container instanceof Catalog) {
      catalog=((Catalog)container).getName();
    }
  }
  boolean isAccess=EDatabaseTypeName.ACCESS.getDisplayName().equals(imetadataConnection.getDbType());
  if (!isAccess) {
    schema=ExtractMetaDataUtils.getMeataConnectionSchema(imetadataConnection);
  }
  addTableForTemCatalogOrSchema(catalog,schema,dbconn,dbtable,imetadataConnection);
}

Fixed version (ground truth):
public static void addTableForSpecifiedDataPackage(DatabaseConnection dbconn,MetadataTable dbtable) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
  IMetadataConnection imetadataConnection=ConvertionHelper.convert(dbconn);
  DatabaseConnection conn=(DatabaseConnection)imetadataConnection.getCurrentConnection();
  Collection<orgomg.cwm.objectmodel.core.Package> newDataPackage=EcoreUtil.copyAll(dbconn.getDataPackage());
  ConnectionHelper.addPackages(newDataPackage,conn);
  String catalog=imetadataConnection.getDatabase();
  String schema="String_Node_Str";
  EObject container=dbtable.eContainer();
  if (container != null) {
    if (container instanceof Schema) {
      schema=((Schema)container).getName();
      EObject c=container.eContainer();
      if (c != null && c instanceof Catalog) {
        catalog=((Catalog)c).getName();
      }
    }
 else     if (container instanceof Catalog) {
      catalog=((Catalog)container).getName();
    }
  }
  boolean isAccess=EDatabaseTypeName.ACCESS.getDisplayName().equals(imetadataConnection.getDbType());
  if (!isAccess) {
    schema=ExtractMetaDataUtils.getInstance().getMeataConnectionSchema(imetadataConnection);
  }
  addTableForTemCatalogOrSchema(catalog,schema,dbconn,dbtable,imetadataConnection);
}
Program: 127355
Project: 127355
Buggy source:
public static void addCatalogOrSchema(IMetadataConnection metadataConnection,DatabaseConnection dbconn){
  EDatabaseSchemaOrCatalogMapping catalog=null;
  EDatabaseSchemaOrCatalogMapping schema=null;
  EDatabaseTypeName type=EDatabaseTypeName.getTypeFromDbType(metadataConnection.getDbType());
  if (type.equals(EDatabaseTypeName.GENERAL_JDBC)) {
    String realtype=ExtractMetaDataUtils.getDbTypeByClassName(metadataConnection.getDriverClass());
    type=EDatabaseTypeName.getTypeFromDbType(realtype);
    catalog=type.getCatalogMappingField();
    schema=type.getSchemaMappingField();
  }
 else {
    catalog=type.getCatalogMappingField();
    schema=type.getSchemaMappingField();
  }
  fillValuesForSchemaOrCatalog(catalog,schema,metadataConnection,dbconn);
}

Fixed version (ground truth):
public static void addCatalogOrSchema(IMetadataConnection metadataConnection,DatabaseConnection dbconn){
  EDatabaseSchemaOrCatalogMapping catalog=null;
  EDatabaseSchemaOrCatalogMapping schema=null;
  EDatabaseTypeName type=EDatabaseTypeName.getTypeFromDbType(metadataConnection.getDbType());
  if (type.equals(EDatabaseTypeName.GENERAL_JDBC)) {
    String realtype=ExtractMetaDataUtils.getInstance().getDbTypeByClassName(metadataConnection.getDriverClass());
    type=EDatabaseTypeName.getTypeFromDbType(realtype);
    catalog=type.getCatalogMappingField();
    schema=type.getSchemaMappingField();
  }
 else {
    catalog=type.getCatalogMappingField();
    schema=type.getSchemaMappingField();
  }
  fillValuesForSchemaOrCatalog(catalog,schema,metadataConnection,dbconn);
}
Program: 127356
Project: 127356
Buggy source:
public static List<org.talend.core.model.metadata.builder.connection.MetadataTable> getTablesFromSpecifiedDataPackageWithOders(DatabaseConnection dbconn){
  IMetadataConnection iMetadataConnection=ConvertionHelper.convert(dbconn);
  String schema=dbconn.getUiSchema();
  String catalog=dbconn.getSID();
  String databaseType=dbconn.getDatabaseType();
  EDatabaseTypeName currentType=EDatabaseTypeName.getTypeFromDbType(databaseType);
  EDatabaseSchemaOrCatalogMapping curCatalog=currentType.getCatalogMappingField();
  EDatabaseSchemaOrCatalogMapping curSchema=currentType.getSchemaMappingField();
  if (curCatalog != null && curSchema != null) {
switch (curCatalog) {
case Login:
      catalog=dbconn.getUsername();
    break;
case None:
  catalog="String_Node_Str";
break;
}
switch (curSchema) {
case Login:
schema=dbconn.getUsername();
break;
case Schema:
schema=dbconn.getUiSchema();
break;
case None:
schema="String_Node_Str";
break;
case Default_Name:
schema=dbconn.getName();
break;
}
}
boolean isAccess=EDatabaseTypeName.ACCESS.getDisplayName().equals(iMetadataConnection.getDbType());
if (!isAccess) {
schema=ExtractMetaDataUtils.getDBConnectionSchema(dbconn);
}
return getTablesFromCurrentCatalogOrSchemaWithOrders(catalog,schema,dbconn);
}

Fixed version (ground truth):
public static List<org.talend.core.model.metadata.builder.connection.MetadataTable> getTablesFromSpecifiedDataPackageWithOders(DatabaseConnection dbconn){
  IMetadataConnection iMetadataConnection=ConvertionHelper.convert(dbconn);
  String schema=dbconn.getUiSchema();
  String catalog=dbconn.getSID();
  String databaseType=dbconn.getDatabaseType();
  EDatabaseTypeName currentType=EDatabaseTypeName.getTypeFromDbType(databaseType);
  EDatabaseSchemaOrCatalogMapping curCatalog=currentType.getCatalogMappingField();
  EDatabaseSchemaOrCatalogMapping curSchema=currentType.getSchemaMappingField();
  if (curCatalog != null && curSchema != null) {
switch (curCatalog) {
case Login:
      catalog=dbconn.getUsername();
    break;
case None:
  catalog="String_Node_Str";
break;
}
switch (curSchema) {
case Login:
schema=dbconn.getUsername();
break;
case Schema:
schema=dbconn.getUiSchema();
break;
case None:
schema="String_Node_Str";
break;
case Default_Name:
schema=dbconn.getName();
break;
}
}
boolean isAccess=EDatabaseTypeName.ACCESS.getDisplayName().equals(iMetadataConnection.getDbType());
if (!isAccess) {
schema=ExtractMetaDataUtils.getInstance().getDBConnectionSchema(dbconn);
}
return getTablesFromCurrentCatalogOrSchemaWithOrders(catalog,schema,dbconn);
}
Program: 127357
Project: 127357
Buggy source:
public static Set<org.talend.core.model.metadata.builder.connection.MetadataTable> getTablesFromSpecifiedDataPackage(DatabaseConnection dbconn){
  IMetadataConnection iMetadataConnection=ConvertionHelper.convert(dbconn);
  String schema=dbconn.getUiSchema();
  String catalog=dbconn.getSID();
  String databaseType=dbconn.getDatabaseType();
  EDatabaseTypeName currentType=EDatabaseTypeName.getTypeFromDbType(databaseType);
  EDatabaseSchemaOrCatalogMapping curCatalog=currentType.getCatalogMappingField();
  EDatabaseSchemaOrCatalogMapping curSchema=currentType.getSchemaMappingField();
  if (curCatalog != null && curSchema != null) {
switch (curCatalog) {
case Login:
      catalog=dbconn.getUsername();
    break;
case None:
  catalog="String_Node_Str";
break;
}
switch (curSchema) {
case Login:
schema=dbconn.getUsername();
break;
case Schema:
schema=dbconn.getUiSchema();
break;
case None:
schema="String_Node_Str";
break;
case Default_Name:
schema=dbconn.getName();
break;
}
}
boolean isAccess=EDatabaseTypeName.ACCESS.getDisplayName().equals(iMetadataConnection.getDbType());
if (!isAccess) {
schema=ExtractMetaDataUtils.getDBConnectionSchema(dbconn);
}
return getTablesFromCurrentCatalogOrSchema(catalog,schema,dbconn);
}

Fixed version (ground truth):
public static Set<org.talend.core.model.metadata.builder.connection.MetadataTable> getTablesFromSpecifiedDataPackage(DatabaseConnection dbconn){
  IMetadataConnection iMetadataConnection=ConvertionHelper.convert(dbconn);
  String schema=dbconn.getUiSchema();
  String catalog=dbconn.getSID();
  String databaseType=dbconn.getDatabaseType();
  EDatabaseTypeName currentType=EDatabaseTypeName.getTypeFromDbType(databaseType);
  EDatabaseSchemaOrCatalogMapping curCatalog=currentType.getCatalogMappingField();
  EDatabaseSchemaOrCatalogMapping curSchema=currentType.getSchemaMappingField();
  if (curCatalog != null && curSchema != null) {
switch (curCatalog) {
case Login:
      catalog=dbconn.getUsername();
    break;
case None:
  catalog="String_Node_Str";
break;
}
switch (curSchema) {
case Login:
schema=dbconn.getUsername();
break;
case Schema:
schema=dbconn.getUiSchema();
break;
case None:
schema="String_Node_Str";
break;
case Default_Name:
schema=dbconn.getName();
break;
}
}
boolean isAccess=EDatabaseTypeName.ACCESS.getDisplayName().equals(iMetadataConnection.getDbType());
if (!isAccess) {
schema=ExtractMetaDataUtils.getInstance().getDBConnectionSchema(dbconn);
}
return getTablesFromCurrentCatalogOrSchema(catalog,schema,dbconn);
}
Program: 127358
Project: 127358
Buggy source:
/** 
 * cli Comment method "setDisposeListener". (bug 6976)
 */
private void setDisposeListener(){
  this.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent event){
      try {
        processWhenDispose();
        ShadowProcessHelper.forceStopPreview();
        ExtractMetaDataUtils.closeConnection(true);
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * cli Comment method "setDisposeListener". (bug 6976)
 */
private void setDisposeListener(){
  this.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent event){
      try {
        processWhenDispose();
        ShadowProcessHelper.forceStopPreview();
        ExtractMetaDataUtils.getInstance().closeConnection(true);
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
  }
);
}
Program: 127359
Project: 127359
Buggy source:
public void widgetDisposed(DisposeEvent event){
  try {
    processWhenDispose();
    ShadowProcessHelper.forceStopPreview();
    ExtractMetaDataUtils.closeConnection(true);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
public void widgetDisposed(DisposeEvent event){
  try {
    processWhenDispose();
    ShadowProcessHelper.forceStopPreview();
    ExtractMetaDataUtils.getInstance().closeConnection(true);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}
Program: 127362
Project: 127362
Buggy source:
private List<String> postFillCatalog(IMetadataConnection metaConnection,List<Catalog> catalogList,List<String> filterList,String catalogName,Connection dbConn){
  Catalog catalog=CatalogHelper.createCatalog(catalogName);
  catalogList.add(catalog);
  DatabaseConnection dbConnection=(DatabaseConnection)dbConn;
  if (dbConnection.getDatabaseType() != null && dbConnection.getDatabaseType().equals(EDatabaseTypeName.AS400.getDisplayName())) {
    IMetadataConnection iMetadataCon=ConvertionHelper.convert(dbConnection);
    if (iMetadataCon != null) {
      if (!StringUtils.isEmpty(iMetadataCon.getDatabase()) && !filterList.contains(iMetadataCon.getDatabase())) {
        filterList.add(iMetadataCon.getDatabase());
      }
      String pattern=ExtractMetaDataUtils.retrieveSchemaPatternForAS400(iMetadataCon.getAdditionalParams());
      if (pattern != null && !"String_Node_Str".equals(pattern)) {
        String[] multiSchems=ExtractMetaDataUtils.getMultiSchems(pattern);
        if (multiSchems != null) {
          for (          String s : multiSchems) {
            if (!StringUtils.isEmpty(s) && !filterList.contains(s)) {
              filterList.add(s);
            }
          }
        }
      }
    }
  }
 else {
    String uiSchema=dbConnection.getUiSchema();
    if (uiSchema != null) {
      uiSchema=TalendCWMService.getReadableName(dbConn,uiSchema);
    }
    if (!StringUtils.isBlank(uiSchema) && !filterList.contains(uiSchema)) {
      filterList.add(uiSchema);
    }
  }
  return filterList;
}

Fixed version (ground truth):
private List<String> postFillCatalog(IMetadataConnection metaConnection,List<Catalog> catalogList,List<String> filterList,String catalogName,Connection dbConn){
  Catalog catalog=CatalogHelper.createCatalog(catalogName);
  catalogList.add(catalog);
  DatabaseConnection dbConnection=(DatabaseConnection)dbConn;
  if (dbConnection.getDatabaseType() != null && dbConnection.getDatabaseType().equals(EDatabaseTypeName.AS400.getDisplayName())) {
    IMetadataConnection iMetadataCon=ConvertionHelper.convert(dbConnection);
    if (iMetadataCon != null) {
      if (!StringUtils.isEmpty(iMetadataCon.getDatabase()) && !filterList.contains(iMetadataCon.getDatabase())) {
        filterList.add(iMetadataCon.getDatabase());
      }
      String pattern=ExtractMetaDataUtils.getInstance().retrieveSchemaPatternForAS400(iMetadataCon.getAdditionalParams());
      if (pattern != null && !"String_Node_Str".equals(pattern)) {
        String[] multiSchems=ExtractMetaDataUtils.getInstance().getMultiSchems(pattern);
        if (multiSchems != null) {
          for (          String s : multiSchems) {
            if (!StringUtils.isEmpty(s) && !filterList.contains(s)) {
              filterList.add(s);
            }
          }
        }
      }
    }
  }
 else {
    String uiSchema=dbConnection.getUiSchema();
    if (uiSchema != null) {
      uiSchema=TalendCWMService.getReadableName(dbConn,uiSchema);
    }
    if (!StringUtils.isBlank(uiSchema) && !filterList.contains(uiSchema)) {
      filterList.add(uiSchema);
    }
  }
  return filterList;
}
Program: 127369
Project: 127369
Buggy source:
/** 
 * zshen Comment method "fillViews".
 * @param pack the object(catalog or schema) which you want views to be filled.Can't be null if need to fill theviews into the object of package(catalog or schema).And if Linked is false everything is ok.
 * @param dbJDBCMetadata If it is null the method will do nothing and return null too.
 * @param viewFilter The list for filter views which you want to get.If it is null all of views which belong to thepackage will be return.
 * @param another method to filter the views.the table will be keep if it's name match to the viewFilter. And if youdon't want to use it null is ok.
 * @return The list of views after filter.Will return null only if dbJDBCMetadata isn't normal.
 */
public List<TdView> fillViews(Package pack,DatabaseMetaData dbJDBCMetadata,List<String> viewFilter,String viewPattern);

Fixed version (ground truth):
/** 
 * zshen Comment method "fillViews".
 * @param pack the object(catalog or schema) which you want views to be filled.Can't be null if need to fill theviews into the object of package(catalog or schema).And if Linked is false everything is ok.
 * @param dbJDBCMetadata If it is null the method will do nothing and return null too.
 * @param viewFilter The list for filter views which you want to get.If it is null all of views which belong to thepackage will be return.
 * @param another method to filter the views.the table will be keep if it's name match to the viewFilter. And if youdon't want to use it null is ok.
 * @return The list of views after filter.Will return null only if dbJDBCMetadata isn't normal.
 */
public List<TdView> fillViews(Package pack,DatabaseMetaData dbJDBCMetadata,List<String> viewFilter,String viewPattern,String[] tableType);
Program: 127370
Project: 127370
Buggy source:
/** 
 * zshen Comment method "fillViews".
 * @param pack the object(catalog or schema) which you want views to be filled.Can't be null if need to fill theviews into the object of package(catalog or schema).And if Linked is false everything is ok.
 * @param dbJDBCMetadata If it is null the method will do nothing and return null too.
 * @param viewFilter The list for filter views which you want to get.If it is null all of views which belong to thepackage will be return.
 * @param another method to filter the views.the table will be keep if it's name match to the viewFilter. And if youdon't want to use it null is ok.
 * @return The list of views after filter.Will return null only if dbJDBCMetadata isn't normal.
 */
public List<TdView> fillViews(Package pack,DatabaseMetaData dbJDBCMetadata,List<String> viewFilter,String viewPattern){
  return metadataFiller.fillViews(pack,dbJDBCMetadata,viewFilter,viewPattern);
}

Fixed version (ground truth):
/** 
 * zshen Comment method "fillViews".
 * @param pack the object(catalog or schema) which you want views to be filled.Can't be null if need to fill theviews into the object of package(catalog or schema).And if Linked is false everything is ok.
 * @param dbJDBCMetadata If it is null the method will do nothing and return null too.
 * @param viewFilter The list for filter views which you want to get.If it is null all of views which belong to thepackage will be return.
 * @param another method to filter the views.the table will be keep if it's name match to the viewFilter. And if youdon't want to use it null is ok.
 * @return The list of views after filter.Will return null only if dbJDBCMetadata isn't normal.
 */
public List<TdView> fillViews(Package pack,DatabaseMetaData dbJDBCMetadata,List<String> viewFilter,String viewPattern,String[] tableType){
  return metadataFiller.fillViews(pack,dbJDBCMetadata,viewFilter,viewPattern,tableType);
}
Program: 127371
Project: 127371
Buggy source:
public List<TdView> fillViews(Package pack,DatabaseMetaData dbJDBCMetadata,List<String> viewFilter,String viewPattern){
  return null;
}

Fixed version (ground truth):
public List<TdView> fillViews(Package pack,DatabaseMetaData dbJDBCMetadata,List<String> viewFilter,String viewPattern,String[] tableTypes){
  return null;
}
Program: 127374
Project: 127374
Buggy source:
public boolean isModified(Property property);

Fixed version (ground truth):
public boolean isModified(Object property);
Program: 127375
Project: 127375
Buggy source:
@Override public boolean isModified(Property property){
  return repositoryFactoryFromProvider.isModified(property);
}

Fixed version (ground truth):
@Override public boolean isModified(Object property){
  return repositoryFactoryFromProvider.isModified(property);
}
Program: 127376
Project: 127376
Buggy source:
public boolean isModified(Property property);

Fixed version (ground truth):
public boolean isModified(Object property);
Program: 127377
Project: 127377
Buggy source:
@Override public boolean isModified(Property property){
  return false;
}

Fixed version (ground truth):
@Override public boolean isModified(Object property){
  return false;
}
Program: 127378
Project: 127378
Buggy source:
private boolean validResourcePath(IResourceDelta delta,IPath topLevelNodeWorkspaceRelativePath,boolean refMerged){
  if (ingoreResource(delta)) {
    return false;
  }
  IResourceDelta[] affectedChildren=delta.getAffectedChildren();
  IResource res=delta.getResource();
  IPath path=delta.getFullPath();
  boolean noChild=(affectedChildren == null || (affectedChildren.length == 0));
  if (!noChild && affectedChildren != null && affectedChildren.length == 1 && FilesUtils.isSVNFolder(affectedChildren[0].getResource())) {
    noChild=true;
  }
  if (path != null && noChild && (FileConstants.PROPERTIES_EXTENSION.equals(path.getFileExtension()) || (res instanceof IContainer))) {
    if (isMatchedPath(topLevelNodeWorkspaceRelativePath,path)) {
      return true;
    }
 else     if (refMerged) {
      if (res != null) {
        path=res.getProjectRelativePath();
      }
 else {
        path=path.removeFirstSegments(1);
      }
      IPath relativePath=topLevelNodeWorkspaceRelativePath.removeFirstSegments(1);
      if (isMatchedPath(relativePath,path)) {
        return true;
      }
    }
  }
  if (affectedChildren != null) {
    for (    IResourceDelta child : affectedChildren) {
      if (validResourcePath(child,topLevelNodeWorkspaceRelativePath,refMerged)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean validResourcePath(IResourceDelta delta,IPath topLevelNodeWorkspaceRelativePath,boolean refMerged){
  if (ingoreResource(delta)) {
    return false;
  }
  IResourceDelta[] affectedChildren=delta.getAffectedChildren();
  IResource res=delta.getResource();
  IPath path=delta.getFullPath();
  boolean noChild=(affectedChildren == null || (affectedChildren.length == 0));
  if (!noChild && affectedChildren != null && affectedChildren.length == 1 && FilesUtils.isSVNFolder(affectedChildren[0].getResource())) {
    noChild=true;
  }
  if (path != null && noChild && (isValidFileResource(res) || (res instanceof IContainer))) {
    if (isMatchedPath(topLevelNodeWorkspaceRelativePath,path)) {
      return true;
    }
 else     if (refMerged) {
      if (res != null) {
        path=res.getProjectRelativePath();
      }
 else {
        path=path.removeFirstSegments(1);
      }
      IPath relativePath=topLevelNodeWorkspaceRelativePath.removeFirstSegments(1);
      if (isMatchedPath(relativePath,path)) {
        return true;
      }
    }
  }
  if (affectedChildren != null) {
    for (    IResourceDelta child : affectedChildren) {
      if (validResourcePath(child,topLevelNodeWorkspaceRelativePath,refMerged)) {
        return true;
      }
    }
  }
  return false;
}
Program: 127387
Project: 127387
Buggy source:
@Test public void testCreateItemResource(){
  URI uri=mock(URI.class);
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Resource resource=basicHandler.createItemResource(uri);
  Assert.assertNotNull(resource);
  Assert.assertEquals(CwmResource.class,resource.getClass());
}

Fixed version (ground truth):
@Test public void testCreateItemResource(){
  URI uri=URI.createURI(processPropPath1.toPortableString());
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Resource resource=basicHandler.createItemResource(uri);
  Assert.assertNotNull(resource);
  Assert.assertEquals(CwmResource.class,resource.getClass());
}
Program: 127388
Project: 127388
Buggy source:
@Test public void testCheckAndSetProject4NoProject(){
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ItemRecord itemRecord=mock(ItemRecord.class);
  Property property=mock(Property.class);
  ProcessItem item=mock(ProcessItem.class);
  when(itemRecord.getProperty()).thenReturn(property);
  when(itemRecord.getItem()).thenReturn(item);
  when(itemRecord.getPath()).thenReturn(processPropPath1);
  ResourcesManager resManager=mock(ResourcesManager.class);
  basicHandler.checkAndSetProject(resManager,itemRecord);
  Assert.assertFalse(itemRecord.getErrors().isEmpty());
  Assert.assertFalse(itemRecord.isValid());
  Assert.assertTrue(itemRecord.getErrors().size() == 1);
}

Fixed version (ground truth):
@Test public void testCheckAndSetProject4NoProject(){
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ItemRecord itemRecord=new ItemRecord(processPropPath1);
  Property property=mock(Property.class);
  itemRecord.setProperty(property);
  ProcessItem item=PropertiesFactory.eINSTANCE.createProcessItem();
  when(property.getItem()).thenReturn(item);
  ResourcesManager resManager=mock(ResourcesManager.class);
  basicHandler.checkAndSetProject(resManager,itemRecord);
  Assert.assertFalse(itemRecord.getErrors().isEmpty());
  Assert.assertFalse(itemRecord.isValid());
  Assert.assertTrue(itemRecord.getErrors().size() == 1);
}
Program: 127389
Project: 127389
Buggy source:
@Test public void testGetItemPath(){
  Item item=mock(Item.class);
  Assert.assertEquals(itemPath,HandlerUtil.getItemPath(propPath,item));
  when(item.getFileExtension()).thenReturn(FileConstants.ITEM_EXTENSION);
  Assert.assertEquals(itemPath,HandlerUtil.getItemPath(propPath,item));
  when(item.getFileExtension()).thenReturn(FileConstants.SCREENSHOT_EXTENSION);
  Assert.assertEquals(new Path("String_Node_Str"),HandlerUtil.getItemPath(propPath,item));
}

Fixed version (ground truth):
@Test public void testGetItemPath(){
  Item item=mock(Item.class);
  when(item.isNeedVersion()).thenReturn(true);
  Assert.assertEquals(itemPath,HandlerUtil.getItemPath(propPath,item));
  when(item.getFileExtension()).thenReturn(FileConstants.ITEM_EXTENSION);
  Assert.assertEquals(itemPath,HandlerUtil.getItemPath(propPath,item));
  when(item.getFileExtension()).thenReturn(FileConstants.SCREENSHOT_EXTENSION);
  Assert.assertEquals(new Path("String_Node_Str"),HandlerUtil.getItemPath(propPath,item));
}
Program: 127390
Project: 127390
Buggy source:
@Test public void testIsSameName4DiffId(){
  ItemRecord itemRecord1=mock(ItemRecord.class);
  Property property1=mock(Property.class);
  when(itemRecord1.getProperty()).thenReturn(property1);
  when(property1.getLabel()).thenReturn("String_Node_Str");
  when(property1.getId()).thenReturn("String_Node_Str");
  IRepositoryViewObject repViewObj=mock(IRepositoryViewObject.class);
  when(repViewObj.getLabel()).thenReturn("String_Node_Str");
  when(repViewObj.getId()).thenReturn("String_Node_Str");
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Assert.assertFalse(basicHandler.isSameName(itemRecord1,repViewObj));
}

Fixed version (ground truth):
@Test public void testIsSameName4DiffId(){
  ItemRecord itemRecord1=mock(ItemRecord.class);
  Property property1=mock(Property.class);
  when(itemRecord1.getProperty()).thenReturn(property1);
  when(property1.getLabel()).thenReturn("String_Node_Str");
  when(property1.getId()).thenReturn("String_Node_Str");
  IRepositoryViewObject repViewObj=mock(IRepositoryViewObject.class);
  when(repViewObj.getLabel()).thenReturn("String_Node_Str");
  when(repViewObj.getId()).thenReturn("String_Node_Str");
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Assert.assertTrue(basicHandler.isSameName(itemRecord1,repViewObj));
}
Program: 127391
Project: 127391
Buggy source:
@Test public void testIsSameName4DiffLabel(){
  ItemRecord itemRecord1=mock(ItemRecord.class);
  Property property1=mock(Property.class);
  when(itemRecord1.getProperty()).thenReturn(property1);
  when(property1.getLabel()).thenReturn("String_Node_Str");
  when(property1.getId()).thenReturn("String_Node_Str");
  IRepositoryViewObject repViewObj=mock(IRepositoryViewObject.class);
  when(repViewObj.getLabel()).thenReturn("String_Node_Str");
  when(repViewObj.getId()).thenReturn("String_Node_Str");
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Assert.assertTrue(basicHandler.isSameName(itemRecord1,repViewObj));
}

Fixed version (ground truth):
@Test public void testIsSameName4DiffLabel(){
  ItemRecord itemRecord1=mock(ItemRecord.class);
  Property property1=mock(Property.class);
  when(itemRecord1.getProperty()).thenReturn(property1);
  when(property1.getLabel()).thenReturn("String_Node_Str");
  when(property1.getId()).thenReturn("String_Node_Str");
  IRepositoryViewObject repViewObj=mock(IRepositoryViewObject.class);
  when(repViewObj.getLabel()).thenReturn("String_Node_Str");
  when(repViewObj.getId()).thenReturn("String_Node_Str");
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  Assert.assertFalse(basicHandler.isSameName(itemRecord1,repViewObj));
}
Program: 127392
Project: 127392
Buggy source:
@Test public void testCheckAndSetProject4NoProject(){
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ItemRecord itemRecord=mock(ItemRecord.class);
  Property property=mock(Property.class);
  when(itemRecord.getProperty()).thenReturn(property);
  when(itemRecord.getPath()).thenReturn(processPropPath1);
  ResourcesManager resManager=mock(ResourcesManager.class);
  basicHandler.checkAndSetProject(resManager,itemRecord);
  Assert.assertFalse(itemRecord.getErrors().isEmpty());
  Assert.assertFalse(itemRecord.isValid());
  Assert.assertTrue(itemRecord.getErrors().size() == 1);
}

Fixed version (ground truth):
@Test public void testCheckAndSetProject4NoProject(){
  ImportBasicHandler basicHandler=new ImportBasicHandler();
  ItemRecord itemRecord=mock(ItemRecord.class);
  Property property=mock(Property.class);
  ProcessItem item=mock(ProcessItem.class);
  when(itemRecord.getProperty()).thenReturn(property);
  when(itemRecord.getItem()).thenReturn(item);
  when(itemRecord.getPath()).thenReturn(processPropPath1);
  ResourcesManager resManager=mock(ResourcesManager.class);
  basicHandler.checkAndSetProject(resManager,itemRecord);
  Assert.assertFalse(itemRecord.getErrors().isEmpty());
  Assert.assertFalse(itemRecord.isValid());
  Assert.assertTrue(itemRecord.getErrors().size() == 1);
}
Program: 127394
Project: 127394
Buggy source:
/** 
 * DOC nrousseau Comment method "getDatabaseValue".
 * @param connection
 * @param value
 * @return
 */
private static Object getDatabaseValue(DatabaseConnection connection,String value){
  return getDatabaseValue(connection,value,null);
}

Fixed version (ground truth):
/** 
 * DOC nrousseau Comment method "getDatabaseValue".
 * @param connection
 * @param value
 * @return
 */
private static Object getDatabaseValue(DatabaseConnection connection,String value){
  return getDatabaseValue(connection,value,null,null);
}
Program: 127396
Project: 127396
Buggy source:
protected boolean forceAddQuote(){
  return false;
}

Fixed version (ground truth):
@Override protected boolean forceAddQuote(){
  return false;
}
Program: 127397
Project: 127397
Buggy source:
/** 
 * For Hive it does need dbName.
 */
protected String getTableNameWithDBAndSchema(final String dbName,final String schema,String tableName){
  return super.getTableNameWithDBAndSchema(null,schema,tableName);
}

Fixed version (ground truth):
/** 
 * For Hive it does need dbName.
 */
@Override protected String getTableNameWithDBAndSchema(final String dbName,final String schema,String tableName){
  return super.getTableNameWithDBAndSchema(dbName,schema,tableName);
}
Program: 127398
Project: 127398
Buggy source:
protected String addQuotesForSQL(String field){
  if (forceAddQuote()) {
    return super.addQuotesForSQL(field);
  }
  return field;
}

Fixed version (ground truth):
@Override protected String addQuotesForSQL(String field){
  if (forceAddQuote()) {
    return super.addQuotesForSQL(field);
  }
  return field;
}
Program: 127401
Project: 127401
Buggy source:
private void moveOldContentToNewFolder(Project project,String completeNewPath,FolderItem emfFolder,FolderItem newFolder,Item child) throws PersistenceException {
  emfFolder.getChildren().remove(child);
  newFolder.getChildren().add(child);
  child.setParent(newFolder);
  moveDQItemToNewFolder(project,completeNewPath,child);
  List<Resource> affectedResources=xmiResourceManager.getAffectedResources(child.getProperty());
  Map<Resource,IPath> resourceAndPathMap=new HashMap<Resource,IPath>();
  for (  Resource resource : affectedResources) {
    IPath path=getPhysicalProject(project).getFullPath().append(completeNewPath).append(resource.getURI().lastSegment());
    resourceAndPathMap.put(resource,path);
    List<Resource> needSaves=findCrossReference(resource);
    moveResource(resource,path);
    saveCrossReference(needSaves);
  }
  IPath parentPath=getPhysicalProject(project).getFullPath().append(completeNewPath);
  svnMoveResource(affectedResources,parentPath,resourceAndPathMap);
  affectedResources=xmiResourceManager.getAffectedResources(child.getProperty());
  for (  Resource resource : affectedResources) {
    xmiResourceManager.saveResource(resource);
  }
}

Fixed version (ground truth):
private void moveOldContentToNewFolder(Project project,String completeNewPath,FolderItem emfFolder,FolderItem newFolder,Item child) throws PersistenceException {
  emfFolder.getChildren().remove(child);
  newFolder.getChildren().add(child);
  child.setParent(newFolder);
  moveDQItemToNewFolder(project,completeNewPath,child);
  List<Resource> affectedResources=xmiResourceManager.getAffectedResources(child.getProperty());
  Map<Resource,IPath> resourceAndPathMap=new HashMap<Resource,IPath>();
  List<Resource> crossReferences=new ArrayList<Resource>();
  for (  Resource resource : affectedResources) {
    IPath path=getPhysicalProject(project).getFullPath().append(completeNewPath).append(resource.getURI().lastSegment());
    resourceAndPathMap.put(resource,path);
    crossReferences.addAll(findCrossReference(resource));
    moveResource(resource,path);
  }
  IPath parentPath=getPhysicalProject(project).getFullPath().append(completeNewPath);
  svnMoveResource(affectedResources,parentPath,resourceAndPathMap);
  saveCrossReference(crossReferences);
  affectedResources=xmiResourceManager.getAffectedResources(child.getProperty());
  for (  Resource resource : affectedResources) {
    xmiResourceManager.saveResource(resource);
  }
}
Program: 127407
Project: 127407
Buggy source:
private void updateCatalog(Property property){
}

Fixed version (ground truth):
/** 
 * update the Catalog object according to the Property, because when the connection has been reloaded, the catalog object should be changed, so need use the new catalog object.
 * @param property
 */
private void updateCatalog(Property property){
  if (catalog != null) {
    Item item=property.getItem();
    if (item != null && item instanceof ConnectionItem) {
      Connection connection=((ConnectionItem)item).getConnection();
      if (connection != null) {
        Catalog catalog2=CatalogHelper.getCatalog(connection,catalog.getName());
        if (catalog2 != null) {
          catalog=catalog2;
        }
      }
    }
  }
}
Program: 127408
Project: 127408
Buggy source:
@Override public Property getProperty(){
  Property property=viewObject.getProperty();
  updateCatalog(property);
  return property;
}

Fixed version (ground truth):
@Override public Property getProperty(){
  Property property=viewObject.getProperty();
  updateSchema(property);
  return property;
}
Program: 127414
Project: 127414
Buggy source:
private void copyResource(Resource resource,IPath path) throws PersistenceException {
  IFile file=URIHelper.getFile(resource.getURI());
  try {
    file.copy(path,true,null);
  }
 catch (  CoreException e) {
    throw new PersistenceException(e);
  }
}

Fixed version (ground truth):
protected void copyResource(Resource resource,IPath path) throws PersistenceException {
  IFile srcFile=URIHelper.getFile(resource.getURI());
  try {
    srcFile.copy(path,true,null);
  }
 catch (  CoreException e) {
    throw new PersistenceException(e);
  }
}