Program: 119738
Project: 119738
Buggy source:
/** 
 * dev Comment method "modifyOldRepositoryNode".
 * @param connection
 * @param iMetadataConnection
 */
@SuppressWarnings("String_Node_Str") private void modifyOldRepositoryNode(DatabaseConnection connection,IMetadataConnection iMetadataConnection,RepositoryNode oldNode) throws Exception {
  boolean status=new ManagerConnection().check(iMetadataConnection);
  connection.setDivergency(!status);
  if (status) {
    List<MetadataTable> tablesFromDB=ExtractMetaDataFromDataBase.returnMetaTablesFormConnection(iMetadataConnection);
    ExtractMetaDataUtils.getInstance().setReconnect(false);
    Set<MetadataTable> tablesetFromEMF=ConnectionHelper.getTables(connection);
    List<MetadataTable> tablesFromEMF=new ArrayList<MetadataTable>();
    tablesFromEMF.addAll(tablesetFromEMF);
    if (oldNode.getProperties(EProperties.CONTENT_TYPE) == RepositoryNodeType.DATABASE) {
      modifyOldConnection(tablesFromEMF,iMetadataConnection,tablesFromDB,oldNode);
      restoreConnection(connection,tablesFromEMF);
    }
 else     if (oldNode.getProperties(EProperties.CONTENT_TYPE) == RepositoryNodeType.TABLE) {
      MetadataTable metadataTable=((MetadataTableRepositoryObject)oldNode.getObject()).getTable();
      modifyOldOneTableFromDB(tablesFromDB,metadataTable);
      MetadataTable tableFromDB=null;
      for (      MetadataTable table : tablesFromDB) {
        if (table.getSourceName().equals(metadataTable.getSourceName())) {
          tableFromDB=table;
        }
      }
      if (tableFromDB != null) {
        List<MetadataColumn> columnsFromDB=new ArrayList<MetadataColumn>();
        columnsFromDB.addAll(ExtractMetaDataFromDataBase.returnMetadataColumnsFormTable(iMetadataConnection,tableFromDB.getSourceName()));
        fixedColumns(columnsFromDB,metadataTable.getColumns());
      }
      restoreConnection(connection,tablesFromEMF);
    }
 else     if (oldNode.getProperties(EProperties.CONTENT_TYPE) == RepositoryNodeType.COLUMN) {
      MetadataColumn metadataColumn=((MetadataColumnRepositoryObject)oldNode.getObject()).getColumn();
      modifyOneColumnFromDB(iMetadataConnection,tablesFromDB,metadataColumn);
    }
  }
 else {
    Set<MetadataTable> tableset=ConnectionHelper.getTables(connection);
    List<MetadataTable> tablesFromEMF=new ArrayList<MetadataTable>();
    tablesFromEMF.addAll(tableset);
    for (    MetadataTable tableFromEMF : tablesFromEMF) {
      List<MetadataColumn> columnsFromEMF=tableFromEMF.getColumns();
      for (      MetadataColumn column : columnsFromEMF) {
        column.setOriginalField("String_Node_Str");
        column.setDivergency(true);
        column.setSynchronised(false);
      }
      tableFromEMF.setSourceName("String_Node_Str");
      tableFromEMF.setDivergency(true);
    }
  }
  ExtractMetaDataUtils.getInstance().setReconnect(true);
}

Fixed version (ground truth):
/** 
 * dev Comment method "modifyOldRepositoryNode".
 * @param connection
 * @param iMetadataConnection
 */
@SuppressWarnings("String_Node_Str") public void modifyOldRepositoryNode(DatabaseConnection connection,IMetadataConnection iMetadataConnection,RepositoryNode oldNode) throws Exception {
  boolean status=new ManagerConnection().check(iMetadataConnection);
  connection.setDivergency(!status);
  if (status) {
    List<MetadataTable> tablesFromDB=ExtractMetaDataFromDataBase.returnMetaTablesFormConnection(iMetadataConnection);
    ExtractMetaDataUtils.getInstance().setReconnect(false);
    Set<MetadataTable> tablesetFromEMF=ConnectionHelper.getTables(connection);
    List<MetadataTable> tablesFromEMF=new ArrayList<MetadataTable>();
    tablesFromEMF.addAll(tablesetFromEMF);
    if (oldNode.getProperties(EProperties.CONTENT_TYPE) == RepositoryNodeType.DATABASE) {
      if (tablesFromEMF.size() < tablesFromDB.size()) {
        modifyOldConnection(tablesFromEMF,iMetadataConnection,tablesFromDB,oldNode);
      }
      restoreConnection(connection,tablesFromEMF);
    }
 else     if (oldNode.getProperties(EProperties.CONTENT_TYPE) == RepositoryNodeType.TABLE) {
      MetadataTable metadataTable=((MetadataTableRepositoryObject)oldNode.getObject()).getTable();
      modifyOldOneTableFromDB(tablesFromDB,metadataTable);
      MetadataTable tableFromDB=null;
      for (      MetadataTable table : tablesFromDB) {
        if (table.getSourceName().equals(metadataTable.getSourceName())) {
          tableFromDB=table;
        }
      }
      if (tableFromDB != null) {
        List<MetadataColumn> columnsFromDB=new ArrayList<MetadataColumn>();
        columnsFromDB.addAll(ExtractMetaDataFromDataBase.returnMetadataColumnsFormTable(iMetadataConnection,tableFromDB.getSourceName()));
        fixedColumns(columnsFromDB,metadataTable.getColumns());
      }
      restoreConnection(connection,tablesFromEMF);
    }
 else     if (oldNode.getProperties(EProperties.CONTENT_TYPE) == RepositoryNodeType.COLUMN) {
      MetadataColumn metadataColumn=((MetadataColumnRepositoryObject)oldNode.getObject()).getColumn();
      modifyOneColumnFromDB(iMetadataConnection,tablesFromDB,metadataColumn);
    }
  }
 else {
    Set<MetadataTable> tableset=ConnectionHelper.getTables(connection);
    List<MetadataTable> tablesFromEMF=new ArrayList<MetadataTable>();
    tablesFromEMF.addAll(tableset);
    for (    MetadataTable tableFromEMF : tablesFromEMF) {
      List<MetadataColumn> columnsFromEMF=tableFromEMF.getColumns();
      for (      MetadataColumn column : columnsFromEMF) {
        column.setOriginalField("String_Node_Str");
        column.setDivergency(true);
        column.setSynchronised(false);
      }
      tableFromEMF.setSourceName("String_Node_Str");
      tableFromEMF.setDivergency(true);
    }
  }
  ExtractMetaDataUtils.getInstance().setReconnect(true);
}