nus-yam/ex-repair huggingface dataset:
Program: 125044
Project: 125044
Buggy source:
public HCatalogSchemaForm(Composite parent,ConnectionItem connectionItem,MetadataTable metadataTable,IWizardPage page,HCatalogConnection temConnection){
  super(parent,SWT.NONE,connectionItem);
  this.parentWizardPage=page;
  this.temConnection=temConnection;
  this.metadataTable=metadataTable;
  final Set<MetadataTable> tables=ConnectionHelper.getTables(temConnection);
  for (  MetadataTable t : tables) {
    if ((metadataTable != null && t.getLabel().equals(metadataTable.getLabel())) || metadataTable == null) {
      this.metadataTable=t;
      break;
    }
  }
  setupForm();
}

Fixed version (ground truth):
public HCatalogSchemaForm(Composite parent,ConnectionItem connectionItem,MetadataTable metadataTable,IWizardPage page,HCatalogConnection temConnection){
  super(parent,SWT.NONE,connectionItem);
  this.parentWizardPage=page;
  this.temConnection=temConnection;
  this.metadataTable=metadataTable;
  final Set<MetadataTable> tables=ConnectionHelper.getTables(temConnection);
  for (  MetadataTable t : tables) {
    if ((metadataTable != null && t.getLabel().equals(metadataTable.getLabel())) || metadataTable == null) {
      this.metadataTable=t;
      break;
    }
  }
}
Program: 125045
Project: 125045
Buggy source:
private Resource create(IProject project,HCatalogConnectionItem item,IPath path,ERepositoryObjectType type) throws PersistenceException {
  Resource itemResource=xmiResourceManager.createItemResource(project,item,path,type,false);
  itemResource.getContents().add(item.getConnection());
  return itemResource;
}

Fixed version (ground truth):
private Resource create(IProject project,HCatalogConnectionItem item,IPath path,ERepositoryObjectType type) throws PersistenceException {
  Resource itemResource=xmiResourceManager.createItemResource(project,item,path,type,false);
  MetadataManager.addContents(item,itemResource);
  itemResource.getContents().add(item.getConnection());
  return itemResource;
}
Program: 125046
Project: 125046
Buggy source:
private Resource create(IProject project,HDFSConnectionItem item,IPath path,ERepositoryObjectType type) throws PersistenceException {
  Resource itemResource=xmiResourceManager.createItemResource(project,item,path,type,false);
  itemResource.getContents().add(item.getConnection());
  return itemResource;
}

Fixed version (ground truth):
private Resource create(IProject project,HDFSConnectionItem item,IPath path,ERepositoryObjectType type) throws PersistenceException {
  Resource itemResource=xmiResourceManager.createItemResource(project,item,path,type,false);
  MetadataManager.addContents(item,itemResource);
  itemResource.getContents().add(item.getConnection());
  return itemResource;
}
Program: 125047
Project: 125047
Buggy source:
@Override public void addNode(ERepositoryObjectType type,RepositoryNode parentNode,IRepositoryViewObject repositoryObject,RepositoryNode node){
  if (type == HadoopClusterRepositoryNodeType.HADOOPCLUSTER) {
    Project project=new Project(ProjectManager.getInstance().getProject(node.getObject().getProperty()));
    for (    IHadoopSubnodeRepositoryContentHandler handler : HadoopSubnodeRepositoryContentManager.getHandlers()) {
      handler.addNode(project,node);
    }
    addHadoopDBNode(node);
  }
}

Fixed version (ground truth):
@Override public void addNode(ERepositoryObjectType type,RepositoryNode parentNode,IRepositoryViewObject repositoryObject,RepositoryNode node){
  if (type == HadoopClusterRepositoryNodeType.HADOOPCLUSTER) {
    Project project=new Project(ProjectManager.getInstance().getProject(node.getObject().getProperty()));
    for (    IHadoopSubnodeRepositoryContentHandler handler : HadoopSubnodeRepositoryContentManager.getHandlers()) {
      handler.addNode(project,node);
    }
    addHadoopDBNode(project,node);
  }
}
Program: 125048
Project: 125048
Buggy source:
private Map<String,Map<String,List<DatabaseConnectionItem>>> getLinkedDbMap(){
  Map<String,Map<String,List<DatabaseConnectionItem>>> linkedDbMap=new HashMap<String,Map<String,List<DatabaseConnectionItem>>>();
  try {
    List<IRepositoryViewObject> repObjs=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.METADATA_CONNECTIONS);
    for (    IRepositoryViewObject repObj : repObjs) {
      if (repObj != null && repObj.getProperty() != null) {
        DatabaseConnectionItem item=(DatabaseConnectionItem)repObj.getProperty().getItem();
        DatabaseConnection connection=(DatabaseConnection)item.getConnection();
        String hcId=connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID);
        if (hcId != null) {
          Map<String,List<DatabaseConnectionItem>> dbItemMap=linkedDbMap.get(hcId);
          if (dbItemMap == null) {
            dbItemMap=new HashMap<String,List<DatabaseConnectionItem>>();
            linkedDbMap.put(hcId,dbItemMap);
          }
          List<DatabaseConnectionItem> itemList=dbItemMap.get(connection.getDatabaseType());
          if (itemList == null) {
            itemList=new ArrayList<DatabaseConnectionItem>();
            dbItemMap.put(connection.getDatabaseType(),itemList);
          }
          itemList.add(item);
        }
      }
    }
  }
 catch (  PersistenceException e) {
  }
  return linkedDbMap;
}

Fixed version (ground truth):
private Map<String,Map<String,List<DatabaseConnectionItem>>> getLinkedDbMap(Project project){
  Map<String,Map<String,List<DatabaseConnectionItem>>> linkedDbMap=new HashMap<String,Map<String,List<DatabaseConnectionItem>>>();
  try {
    List<IRepositoryViewObject> repObjs=ProxyRepositoryFactory.getInstance().getAll(project,ERepositoryObjectType.METADATA_CONNECTIONS);
    for (    IRepositoryViewObject repObj : repObjs) {
      if (repObj != null && repObj.getProperty() != null) {
        DatabaseConnectionItem item=(DatabaseConnectionItem)repObj.getProperty().getItem();
        DatabaseConnection connection=(DatabaseConnection)item.getConnection();
        String hcId=connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID);
        if (hcId != null) {
          Map<String,List<DatabaseConnectionItem>> dbItemMap=linkedDbMap.get(hcId);
          if (dbItemMap == null) {
            dbItemMap=new HashMap<String,List<DatabaseConnectionItem>>();
            linkedDbMap.put(hcId,dbItemMap);
          }
          List<DatabaseConnectionItem> itemList=dbItemMap.get(connection.getDatabaseType());
          if (itemList == null) {
            itemList=new ArrayList<DatabaseConnectionItem>();
            dbItemMap.put(connection.getDatabaseType(),itemList);
          }
          itemList.add(item);
        }
      }
    }
  }
 catch (  PersistenceException e) {
  }
  return linkedDbMap;
}
Program: 125049
Project: 125049
Buggy source:
private void addHadoopDBNode(RepositoryNode parentNode){
  String id=parentNode.getObject().getId();
  Map<String,List<DatabaseConnectionItem>> dbItemMap=getLinkedDbMap().get(id);
  if (dbItemMap != null && dbItemMap.size() > 0) {
    Iterator<Entry<String,List<DatabaseConnectionItem>>> iterator=dbItemMap.entrySet().iterator();
    while (iterator.hasNext()) {
      Map.Entry<String,List<DatabaseConnectionItem>> entry=iterator.next();
      List<DatabaseConnectionItem> dbItems=entry.getValue();
      EDatabaseConnTemplate dbTemplate=EDatabaseConnTemplate.indexOfTemplate(entry.getKey());
      RepositoryNode hadoopFolderNode=createHadoopFolderNode(parentNode,ERepositoryObjectType.METADATA_CONNECTIONS,dbTemplate.getDBDisplayName(),dbItems.size());
      parentNode.getChildren().add(hadoopFolderNode);
      for (      DatabaseConnectionItem dbItem : dbItems) {
        RepositoryNode hadoopSubNode=createHadoopSubNode(hadoopFolderNode,dbItem);
      }
    }
  }
}

Fixed version (ground truth):
private void addHadoopDBNode(Project project,RepositoryNode parentNode){
  String id=parentNode.getObject().getId();
  Map<String,List<DatabaseConnectionItem>> dbItemMap=getLinkedDbMap(project).get(id);
  if (dbItemMap != null && dbItemMap.size() > 0) {
    Iterator<Entry<String,List<DatabaseConnectionItem>>> iterator=dbItemMap.entrySet().iterator();
    while (iterator.hasNext()) {
      Map.Entry<String,List<DatabaseConnectionItem>> entry=iterator.next();
      List<DatabaseConnectionItem> dbItems=entry.getValue();
      EDatabaseConnTemplate dbTemplate=EDatabaseConnTemplate.indexOfTemplate(entry.getKey());
      RepositoryNode hadoopFolderNode=createHadoopFolderNode(parentNode,ERepositoryObjectType.METADATA_CONNECTIONS,dbTemplate.getDBDisplayName(),dbItems.size());
      parentNode.getChildren().add(hadoopFolderNode);
      for (      DatabaseConnectionItem dbItem : dbItems) {
        RepositoryNode hadoopSubNode=createHadoopSubNode(hadoopFolderNode,dbItem);
      }
    }
  }
}
Program: 125050
Project: 125050
Buggy source:
/** 
 * DOC ycbai Comment method "extractPartitionsJsonStr". Extract partition json string.
 * @param connection
 * @param tableName
 * @return
 * @throws Exception
 */
public static synchronized String extractPartitionsJsonStr(HCatalogConnection connection,String tableName) throws Exception {
  String path=connection.getDatabase() + SEPARATOR + TABLE+ SEPARATOR+ tableName+ SEPARATOR+ PARTITION;
  WebClient client=HCatalogServiceUtil.getHCatalogClient(connection,path);
  JSONObject obj=HCatalogServiceUtil.getDataFromHCatalog(client);
  if (obj != null) {
    return obj.toJSONString();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "extractPartitionsJsonStr". Extract partition json string.
 * @param connection
 * @param tableName
 * @return
 * @throws Exception
 */
public static synchronized String extractPartitionsJsonStr(HCatalogConnection connection,String tableName) throws Exception {
  String path=connection.getDatabase() + SEPARATOR + TABLE+ SEPARATOR+ tableName+ SEPARATOR+ PARTITION;
  WebClient client=HCatalogServiceUtil.getHCatalogClient(connection,path);
  JSONObject obj=HCatalogServiceUtil.getDataFromHCatalog(client,tableName);
  if (obj != null) {
    return obj.toJSONString();
  }
  return null;
}
Program: 125051
Project: 125051
Buggy source:
/** 
 * DOC ycbai Comment method "getDataFromHCatalog". Get data from HCatalog client.
 * @param client
 * @return
 * @throws Exception
 */
public static JSONObject getDataFromHCatalog(WebClient client) throws Exception {
  Response response=client.get();
  InputStream inputStream=(InputStream)response.getEntity();
  String input=IOUtils.toString(inputStream);
  JSONObject jsonObject=(JSONObject)JSONValue.parse(input);
  String errorMsgDetail="String_Node_Str";
  Object errorObj=jsonObject.get("String_Node_Str");
  if (errorObj != null) {
    errorMsgDetail=errorObj.toString();
  }
  int status=response.getStatus();
  if (status != 200) {
switch (status) {
case 400:
      throw new Exception("String_Node_Str" + errorMsgDetail);
case 401:
    throw new Exception("String_Node_Str" + errorMsgDetail);
case 404:
  throw new Exception("String_Node_Str" + errorMsgDetail);
case 500:
throw new Exception("String_Node_Str" + errorMsgDetail);
case 503:
throw new Exception("String_Node_Str" + errorMsgDetail);
default :
throw new Exception(jsonObject.get("String_Node_Str") + "String_Node_Str" + jsonObject.get("String_Node_Str")+ jsonObject.get("String_Node_Str"));
}
}
return jsonObject;
}

Fixed version (ground truth):
public static JSONObject getDataFromHCatalog(WebClient client,String tableName) throws Exception {
  Response response=client.get();
  InputStream inputStream=(InputStream)response.getEntity();
  String input=IOUtils.toString(inputStream);
  JSONObject jsonObject=(JSONObject)JSONValue.parse(input);
  String errorMsgDetail="String_Node_Str";
  Object errorObj=jsonObject.get("String_Node_Str");
  if (errorObj != null) {
    errorMsgDetail=errorObj.toString();
  }
  int status=response.getStatus();
  if (status != 200) {
switch (status) {
case 400:
      throw new Exception("String_Node_Str" + errorMsgDetail);
case 401:
    throw new Exception("String_Node_Str" + errorMsgDetail);
case 404:
  throw new Exception("String_Node_Str" + errorMsgDetail);
case 500:
if (("String_Node_Str" + tableName + "String_Node_Str").equals(errorMsgDetail)) {
  CommonExceptionHandler.warn("String_Node_Str" + errorMsgDetail);
}
 else {
  throw new Exception("String_Node_Str" + errorMsgDetail);
}
break;
case 503:
throw new Exception("String_Node_Str" + errorMsgDetail);
default :
throw new Exception(jsonObject.get("String_Node_Str") + "String_Node_Str" + jsonObject.get("String_Node_Str")+ jsonObject.get("String_Node_Str"));
}
}
return jsonObject;
}
Program: 125052
Project: 125052
Buggy source:
private void initTreeNavigatorNodes(){
  List<MetadataTable> tables=ConnectionHelper.getTablesWithOrders(getConnection());
  if (metadataTable == null) {
    if (tables != null && !tables.isEmpty()) {
      for (      MetadataTable table : tables) {
        if (!TableHelper.isDeleted(table)) {
          metadataTable=table;
          break;
        }
      }
    }
 else {
      addMetadataTable();
    }
  }
  tableNavigator.removeAll();
  List<String> tablenames=new ArrayList<String>();
  for (  MetadataTable t : tables) {
    tablenames.add(t.getLabel());
  }
  String[] allTableLabel=tablenames.toArray(new String[0]);
  Arrays.sort(allTableLabel);
  for (  String element : allTableLabel) {
    if (element.equals(metadataTable.getLabel())) {
      TableItem subItem=new TableItem(tableNavigator,SWT.NONE);
      subItem.setText(element);
      tableNavigator.setSelection(subItem);
    }
 else {
      TableItem subItem=new TableItem(tableNavigator,SWT.NONE);
      subItem.setText(element);
    }
  }
}

Fixed version (ground truth):
private void initTreeNavigatorNodes(){
  tableNavigator.removeAll();
  List<MetadataTable> tables=ConnectionHelper.getTablesWithOrders(getConnection());
  if (tables != null && !tables.isEmpty()) {
    boolean metadataTableExist=false;
    if (metadataTable == null) {
      metadataTableExist=false;
    }
 else {
      for (      MetadataTable table : tables) {
        if (table.getLabel().equals(metadataTable.getLabel())) {
          metadataTableExist=true;
        }
      }
    }
    if (!metadataTableExist) {
      metadataTable=tables.get(0);
    }
    Collections.sort(tables,new Comparator<MetadataTable>(){
      @Override public int compare(      MetadataTable tab1,      MetadataTable tab2){
        String tab1Label=tab1.getLabel();
        String tab2Label=tab2.getLabel();
        return tab1Label.compareTo(tab2Label);
      }
    }
);
    for (    MetadataTable table : tables) {
      String tabLabel=table.getLabel();
      TableItem subItem=new TableItem(tableNavigator,SWT.NONE);
      subItem.setText(tabLabel);
      if (tabLabel.equals(metadataTable.getLabel())) {
        tableNavigator.setSelection(subItem);
      }
    }
  }
}
Program: 125053
Project: 125053
Buggy source:
private void initMetadataForm(){
  metadataEditor.setMetadataTable(metadataTable);
  IPreferenceStore store=RepositoryManager.getPreferenceStore();
  Boolean flag=store.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS);
  if (!flag.booleanValue()) {
    List<MetadataColumn> list=metadataEditor.getMetadataColumnList();
    for (    MetadataColumn column : list) {
      if (!isCnorEn(column.getLabel())) {
        String label=metadataEditor.getNextGeneratedColumnName("String_Node_Str");
        column.setLabel(label);
      }
    }
  }
  tableEditorView.setMetadataEditor(metadataEditor);
  tableEditorView.getTableViewerCreator().layout();
  metadataEditor.addAfterOperationListListener(new IListenableListListener(){
    @Override public void handleEvent(    ListenableListEvent event){
      changeTableNavigatorStatus(checkFieldsValue());
    }
  }
);
  String label=MetadataToolHelper.validateValue(metadataTable.getLabel());
  nameText.setText(label);
  commentText.setText(metadataTable.getComment());
  updateRetreiveSchemaButton();
  nameText.forceFocus();
}

Fixed version (ground truth):
private void initMetadataForm(){
  if (metadataTable == null) {
    return;
  }
  metadataEditor.setMetadataTable(metadataTable);
  IPreferenceStore store=RepositoryManager.getPreferenceStore();
  Boolean flag=store.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS);
  if (!flag.booleanValue()) {
    List<MetadataColumn> list=metadataEditor.getMetadataColumnList();
    for (    MetadataColumn column : list) {
      if (!isCnorEn(column.getLabel())) {
        String label=metadataEditor.getNextGeneratedColumnName("String_Node_Str");
        column.setLabel(label);
      }
    }
  }
  tableEditorView.setMetadataEditor(metadataEditor);
  tableEditorView.getTableViewerCreator().layout();
  metadataEditor.addAfterOperationListListener(new IListenableListListener(){
    @Override public void handleEvent(    ListenableListEvent event){
      changeTableNavigatorStatus(checkFieldsValue());
    }
  }
);
  String label=MetadataToolHelper.validateValue(metadataTable.getLabel());
  nameText.setText(label);
  commentText.setText(metadataTable.getComment());
  updateRetreiveSchemaButton();
  nameText.forceFocus();
}
Program: 125054
Project: 125054
Buggy source:
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table){
  if (value != null && canHandle(connection)) {
    return getHadoopClusterRepositoryValue((HadoopClusterConnection)connection,value,table);
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent){
  if (value != null && canHandle(connection)) {
    return getHadoopClusterRepositoryValue((HadoopClusterConnection)connection,value,table);
  }
  return null;
}
Program: 125055
Project: 125055
Buggy source:
@Override protected boolean hideAction(RepositoryNode node){
  HadoopClusterConnectionItem hcConnectionItem=HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
  if (hcConnectionItem != null) {
    HadoopClusterConnection hcConnection=(HadoopClusterConnection)hcConnectionItem.getConnection();
    EHadoopDistributions distribution=EHadoopDistributions.getDistributionByName(hcConnection.getDistribution(),false);
    if (distribution == EHadoopDistributions.HORTONWORKS) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override protected boolean hideAction(RepositoryNode node){
  HadoopClusterConnectionItem hcConnectionItem=HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
  if (hcConnectionItem != null) {
    HadoopClusterConnection hcConnection=(HadoopClusterConnection)hcConnectionItem.getConnection();
    EHadoopDistributions distribution=EHadoopDistributions.getDistributionByName(hcConnection.getDistribution(),false);
    if (distribution == EHadoopDistributions.HORTONWORKS || distribution == EHadoopDistributions.CUSTOM) {
      return false;
    }
  }
  return true;
}
Program: 125056
Project: 125056
Buggy source:
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table){
  if (value != null && canHandle(connection)) {
    return getHCatalogRepositoryValue((HCatalogConnection)connection,value,table);
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent){
  if (value != null && canHandle(connection)) {
    return getHCatalogRepositoryValue((HCatalogConnection)connection,value,table,targetComponent);
  }
  return null;
}
Program: 125058
Project: 125058
Buggy source:
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table){
  if (value != null && canHandle(connection)) {
    return getHDFSRepositoryValue((HDFSConnection)connection,value,table);
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent){
  if (value != null && canHandle(connection)) {
    return getHDFSRepositoryValue((HDFSConnection)connection,value,table,targetComponent);
  }
  return null;
}
Program: 125060
Project: 125060
Buggy source:
@Override protected void deleteNode(Item item) throws Exception {
  final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  HadoopClusterConnectionItem hadoopClusterItem=(HadoopClusterConnectionItem)item;
  HadoopClusterConnection connection=(HadoopClusterConnection)hadoopClusterItem.getConnection();
  List<String> connectionList=connection.getConnectionList();
  for (  String connId : connectionList) {
    IRepositoryViewObject repObj=null;
    try {
      repObj=factory.getLastVersion(connId);
    }
 catch (    PersistenceException e) {
    }
    if (repObj != null) {
      factory.deleteObjectPhysical(repObj);
    }
  }
  connection.getConnectionList().clear();
  factory.save(hadoopClusterItem);
}

Fixed version (ground truth):
@Override protected void deleteNode(Item item) throws Exception {
  final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  Project project=new Project(ProjectManager.getInstance().getProject(item.getProperty()));
  HadoopClusterConnectionItem hadoopClusterItem=(HadoopClusterConnectionItem)item;
  HadoopClusterConnection connection=(HadoopClusterConnection)hadoopClusterItem.getConnection();
  List<String> connectionList=connection.getConnectionList();
  for (  String connId : connectionList) {
    IRepositoryViewObject repObj=null;
    try {
      repObj=factory.getLastVersion(project,connId);
    }
 catch (    PersistenceException e) {
    }
    if (repObj != null) {
      factory.deleteObjectPhysical(repObj);
    }
  }
  connection.getConnectionList().clear();
  factory.save(hadoopClusterItem);
  String clusterId=hadoopClusterItem.getProperty().getId();
  List<IRepositoryViewObject> repObjs=ProxyRepositoryFactory.getInstance().getAll(project,ERepositoryObjectType.METADATA_CONNECTIONS);
  for (  IRepositoryViewObject repObj : repObjs) {
    if (repObj != null && repObj.getProperty() != null) {
      DatabaseConnectionItem dbItem=(DatabaseConnectionItem)repObj.getProperty().getItem();
      DatabaseConnection dbConnection=(DatabaseConnection)dbItem.getConnection();
      String hcId=dbConnection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID);
      if (clusterId.equals(hcId)) {
        dbConnection.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID,null);
        factory.save(dbItem);
      }
    }
  }
}
Program: 125061
Project: 125061
Buggy source:
/** 
 * DOC ycbai Comment method "getSubitemsOfHadoopCluster". Get subitems of hadoop cluster like hdfs, hcatalog, hive etc.
 * @param item
 * @return
 */
public static Set<Item> getSubitemsOfHadoopCluster(Item item){
  Set<Item> subItems=new HashSet<Item>();
  if (item.eClass() != HadoopClusterPackage.Literals.HADOOP_CLUSTER_CONNECTION_ITEM) {
    return subItems;
  }
  HadoopClusterConnectionItem clusterConnectionItem=(HadoopClusterConnectionItem)item;
  HadoopClusterConnection clusterConnection=(HadoopClusterConnection)clusterConnectionItem.getConnection();
  EList<String> connectionList=clusterConnection.getConnectionList();
  for (  String connId : connectionList) {
    if (connId != null) {
      IRepositoryViewObject repObj=null;
      try {
        repObj=ProxyRepositoryFactory.getInstance().getLastVersion(connId);
      }
 catch (      PersistenceException e) {
        ExceptionHandler.process(e);
      }
      if (repObj != null && repObj.getProperty() != null) {
        Item subItem=repObj.getProperty().getItem();
        if (subItem != null) {
          subItems.add(subItem);
        }
      }
    }
  }
  return subItems;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getSubitemsOfHadoopCluster". Get subitems of hadoop cluster like hdfs, hcatalog, hive etc.
 * @param item
 * @return
 * @throws PersistenceException
 */
public static Set<Item> getSubitemsOfHadoopCluster(Item item) throws PersistenceException {
  Set<Item> subItems=new HashSet<Item>();
  if (item.eClass() != HadoopClusterPackage.Literals.HADOOP_CLUSTER_CONNECTION_ITEM) {
    return subItems;
  }
  Project project=new Project(ProjectManager.getInstance().getProject(item.getProperty()));
  HadoopClusterConnectionItem clusterConnectionItem=(HadoopClusterConnectionItem)item;
  HadoopClusterConnection clusterConnection=(HadoopClusterConnection)clusterConnectionItem.getConnection();
  EList<String> connectionList=clusterConnection.getConnectionList();
  for (  String connId : connectionList) {
    if (connId != null) {
      IRepositoryViewObject repObj=ProxyRepositoryFactory.getInstance().getLastVersion(project,connId);
      if (repObj != null && repObj.getProperty() != null) {
        Item subItem=repObj.getProperty().getItem();
        if (subItem != null) {
          subItems.add(subItem);
        }
      }
    }
  }
  String clusterId=clusterConnectionItem.getProperty().getId();
  List<IRepositoryViewObject> repObjs=ProxyRepositoryFactory.getInstance().getAll(project,ERepositoryObjectType.METADATA_CONNECTIONS);
  for (  IRepositoryViewObject repObj : repObjs) {
    if (repObj != null && repObj.getProperty() != null) {
      DatabaseConnectionItem dbItem=(DatabaseConnectionItem)repObj.getProperty().getItem();
      DatabaseConnection dbConnection=(DatabaseConnection)dbItem.getConnection();
      String hcId=dbConnection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID);
      if (clusterId.equals(hcId)) {
        subItems.add(dbItem);
      }
    }
  }
  return subItems;
}
Program: 125062
Project: 125062
Buggy source:
@Override protected int getWizardWidth(){
  return 600;
}

Fixed version (ground truth):
@Override protected int getWizardWidth(){
  return 780;
}
Program: 125063
Project: 125063
Buggy source:
@Override public boolean isHadoopSubItem(Item item){
  if (isHadoopClusterItem(item)) {
    return false;
  }
  for (  IHadoopSubnodeRepositoryContentHandler handler : HadoopSubnodeRepositoryContentManager.getHandlers()) {
    if (handler.getRelativeHadoopClusterItemId(item) != null) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isHadoopSubItem(Item item){
  if (isHadoopClusterItem(item)) {
    return false;
  }
  for (  IHadoopSubnodeRepositoryContentHandler handler : HadoopSubnodeRepositoryContentManager.getHandlers()) {
    if (handler.isProcess(item)) {
      return true;
    }
  }
  return false;
}
Program: 125064
Project: 125064
Buggy source:
public static Map<String,Set<String>> getCustomVersionMap(HadoopClusterConnection connection){
  Map<String,Set<String>> map=new HashMap<String,Set<String>>();
  if (connection == null) {
    return map;
  }
  EMap<String,String> parameters=connection.getParameters();
  if (parameters.size() == 0) {
    return map;
  }
  ECustomVersionGroup[] values=ECustomVersionGroup.values();
  for (  ECustomVersionGroup group : values) {
    String groupName=group.getName();
    String jarString=parameters.get(groupName);
    if (jarString != null) {
      Set<String> jarSet=new HashSet<String>();
      String[] jarArray=jarString.split(JAR_SEPARATOR);
      for (      String jar : jarArray) {
        jarSet.add(jar);
      }
      map.put(groupName,jarSet);
    }
  }
  return map;
}

Fixed version (ground truth):
public static Map<String,Set<String>> getCustomVersionMap(HadoopClusterConnection connection){
  Map<String,Set<String>> map=new HashMap<String,Set<String>>();
  if (connection == null) {
    return map;
  }
  EMap<String,String> parameters=connection.getParameters();
  if (parameters.size() == 0) {
    return map;
  }
  ECustomVersionGroup[] values=ECustomVersionGroup.values();
  for (  ECustomVersionGroup group : values) {
    String groupName=group.getName();
    String jarString=parameters.get(groupName);
    if (jarString != null && !jarString.isEmpty()) {
      Set<String> jarSet=new HashSet<String>();
      String[] jarArray=jarString.split(JAR_SEPARATOR);
      for (      String jar : jarArray) {
        jarSet.add(jar);
      }
      map.put(groupName,jarSet);
    }
  }
  return map;
}
Program: 125065
Project: 125065
Buggy source:
@Override protected String getClusterName(HadoopSubConnection hadoopSubConnection){
  StringBuffer cnBuffer=new StringBuffer();
  cnBuffer.append("String_Node_Str");
  HCatalogConnection connection=(HCatalogConnection)hadoopSubConnection;
  EHadoopVersion4Drivers version=EHadoopVersion4Drivers.indexOfByVersion(connection.getHcatVersion());
  String hostName=connection.getHostName();
  if (version != null) {
    cnBuffer.append(version.getVersionDisplay());
    cnBuffer.append(UNDER_LINE);
  }
  if (hostName != null) {
    cnBuffer.append(hostName);
  }
  String clusterName=cnBuffer.toString();
  clusterName=clusterName.replaceAll("String_Node_Str",UNDER_LINE);
  return clusterName;
}

Fixed version (ground truth):
@Override protected String getClusterName(HadoopSubConnection hadoopSubConnection){
  StringBuffer cnBuffer=new StringBuffer();
  HCatalogConnection connection=(HCatalogConnection)hadoopSubConnection;
  EHadoopVersion4Drivers version=EHadoopVersion4Drivers.indexOfByVersion(connection.getHcatVersion());
  String hostName=connection.getHostName();
  if (version != null) {
    cnBuffer.append(version.getVersionValue());
    cnBuffer.append(UNDER_LINE);
  }
  if (hostName != null) {
    cnBuffer.append(hostName);
  }
  String clusterName=cnBuffer.toString();
  clusterName=clusterName.replaceAll("String_Node_Str",UNDER_LINE);
  return clusterName;
}
Program: 125066
Project: 125066
Buggy source:
@Override protected String getClusterName(HadoopSubConnection hadoopConnection){
  StringBuffer cnBuffer=new StringBuffer();
  cnBuffer.append("String_Node_Str");
  HDFSConnection connection=(HDFSConnection)hadoopConnection;
  EHadoopVersion4Drivers version=EHadoopVersion4Drivers.indexOfByVersion(connection.getDfVersion());
  if (version != null) {
    cnBuffer.append(version.getVersionDisplay());
    cnBuffer.append(UNDER_LINE);
  }
  String nameNodeURI=connection.getNameNodeURI();
  if (nameNodeURI != null) {
    cnBuffer.append(HadoopParameterUtil.getHostNameFromNameNodeURI(nameNodeURI));
  }
  String clusterName=cnBuffer.toString();
  clusterName=clusterName.replaceAll("String_Node_Str",UNDER_LINE);
  return clusterName;
}

Fixed version (ground truth):
@Override protected String getClusterName(HadoopSubConnection hadoopConnection){
  StringBuffer cnBuffer=new StringBuffer();
  HDFSConnection connection=(HDFSConnection)hadoopConnection;
  EHadoopVersion4Drivers version=EHadoopVersion4Drivers.indexOfByVersion(connection.getDfVersion());
  if (version != null) {
    cnBuffer.append(version.getVersionValue());
    cnBuffer.append(UNDER_LINE);
  }
  String nameNodeURI=connection.getNameNodeURI();
  if (nameNodeURI != null) {
    cnBuffer.append(HadoopParameterUtil.getHostNameFromNameNodeURI(nameNodeURI));
  }
  String clusterName=cnBuffer.toString();
  clusterName=clusterName.replaceAll("String_Node_Str",UNDER_LINE);
  return clusterName;
}
Program: 125068
Project: 125068
Buggy source:
@Override public void modifyText(final ModifyEvent e){
  getConnection().setFieldSeparator(fieldSeparatorText.getText());
  checkFieldsValue();
  EHDFSFieldSeparator fieldSeparator=EHDFSFieldSeparator.indexOf(fieldSeparatorText.getText(),false);
  if (fieldSeparator == null) {
    fieldSeparatorCombo.deselectAll();
  }
 else {
    fieldSeparatorCombo.setText(fieldSeparator.getDisplayName());
  }
}

Fixed version (ground truth):
@Override public void modifyText(final ModifyEvent e){
  getConnection().setFieldSeparator(fieldSeparatorText.getText());
  checkFieldsValue();
  EHDFSFieldSeparator fieldSeparator=EHDFSFieldSeparator.indexOf(fieldSeparatorText.getText(),false);
  if (fieldSeparator == null) {
    fieldSeparatorCombo.deselectAll();
  }
 else {
    String originalValue=fieldSeparatorCombo.getText();
    String newValue=fieldSeparator.getDisplayName();
    if (!newValue.equals(originalValue)) {
      fieldSeparatorCombo.setText(newValue);
    }
  }
}
Program: 125069
Project: 125069
Buggy source:
@Override public IComponentName getCorrespondingComponentName(Item item,ERepositoryObjectType type){
  RepositoryComponentSetting setting=new RepositoryComponentSetting();
  setting.setName(HCATALOG);
  setting.setRepositoryType(HCATALOG);
  setting.setWithSchema(true);
  setting.setInputComponent(INPUT);
  setting.setOutputComponent(OUTPUT);
  List<Class<Item>> list=new ArrayList<Class<Item>>();
  Class clazz=null;
  try {
    clazz=Class.forName(HCatalogConnectionItem.class.getName());
  }
 catch (  ClassNotFoundException e) {
    ExceptionHandler.process(e);
  }
  list.add(clazz);
  setting.setClasses(list.toArray(new Class[0]));
  return setting;
}

Fixed version (ground truth):
@Override public IComponentName getCorrespondingComponentName(Item item,ERepositoryObjectType type){
  RepositoryComponentSetting setting=null;
  if (item instanceof HCatalogConnectionItem) {
    setting=new RepositoryComponentSetting();
    setting.setName(HCATALOG);
    setting.setRepositoryType(HCATALOG);
    setting.setWithSchema(true);
    setting.setInputComponent(INPUT);
    setting.setOutputComponent(OUTPUT);
    List<Class<Item>> list=new ArrayList<Class<Item>>();
    Class clazz=null;
    try {
      clazz=Class.forName(HCatalogConnectionItem.class.getName());
    }
 catch (    ClassNotFoundException e) {
      ExceptionHandler.process(e);
    }
    list.add(clazz);
    setting.setClasses(list.toArray(new Class[0]));
  }
  return setting;
}
Program: 125070
Project: 125070
Buggy source:
private boolean checkHDFSConnection(final HDFSConnection connection){
  final boolean[] result=new boolean[]{true};
  IRunnableWithProgress runnableWithProgress=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
      try {
        HadoopServerManager.getInstance().getDFS(connection,true);
      }
 catch (      Exception e) {
        PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
          @Override public void run(){
            String mainMsg=Messages.getString("String_Node_Str");
            String detailMsg=Messages.getString("String_Node_Str",connection.getNameNodeURI());
            new ErrorDialogWidthDetailArea(PlatformUI.getWorkbench().getDisplay().getActiveShell(),Activator.PLUGIN_ID,mainMsg,detailMsg);
            result[0]=false;
            return;
          }
        }
);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  ProgressMonitorDialog dialog=new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
  try {
    dialog.run(true,true,runnableWithProgress);
  }
 catch (  Exception e) {
    result[0]=false;
    ExceptionHandler.process(e);
  }
  return result[0];
}

Fixed version (ground truth):
private boolean checkHDFSConnection(final HDFSConnection connection){
  final boolean[] result=new boolean[]{true};
  IRunnableWithProgress runnableWithProgress=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
      try {
        HDFSConnectionBean connectionBean=HDFSModelUtil.convert2HDFSConnectionBean(connection);
        HadoopOperationManager.getInstance().connectDFS(connectionBean);
      }
 catch (      Exception e) {
        PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
          @Override public void run(){
            String mainMsg=Messages.getString("String_Node_Str");
            String detailMsg=Messages.getString("String_Node_Str",connection.getNameNodeURI());
            new ErrorDialogWidthDetailArea(PlatformUI.getWorkbench().getDisplay().getActiveShell(),Activator.PLUGIN_ID,mainMsg,detailMsg);
            result[0]=false;
            return;
          }
        }
);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  ProgressMonitorDialog dialog=new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
  try {
    dialog.run(true,true,runnableWithProgress);
  }
 catch (  Exception e) {
    result[0]=false;
    ExceptionHandler.process(e);
  }
  return result[0];
}
Program: 125071
Project: 125071
Buggy source:
protected ConnectionStatus checkConnection(boolean displayDialog){
  ConnectionStatus connectionStatus=HadoopServerUtil.testConnection(HDFSModelUtil.convert2HDFSConnectionBean(getConnection()));
  hdfsSettingIsValide=connectionStatus.getResult();
  String connectException=connectionStatus.getMessageException();
  if (hdfsSettingIsValide) {
    if (!isReadOnly()) {
      updateStatus(IStatus.OK,null);
    }
    if (displayDialog) {
      MessageDialog.openInformation(getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str",connectionItem.getProperty().getDisplayName()));
    }
  }
 else {
    String mainMsg=Messages.getString("String_Node_Str");
    if (!isReadOnly()) {
      updateStatus(IStatus.WARNING,mainMsg);
    }
    if (displayDialog) {
      new ErrorDialogWidthDetailArea(getShell(),Activator.PLUGIN_ID,mainMsg,connectException);
    }
  }
  return connectionStatus;
}

Fixed version (ground truth):
protected ConnectionStatus checkConnection(boolean displayDialog){
  HDFSConnectionBean connectionBean=getConnectionBean();
  ConnectionStatus connectionStatus=HadoopOperationManager.getInstance().testConnection(connectionBean);
  hdfsSettingIsValide=connectionStatus.getResult();
  String connectException=connectionStatus.getMessageException();
  if (hdfsSettingIsValide) {
    if (!isReadOnly()) {
      updateStatus(IStatus.OK,null);
    }
    if (displayDialog) {
      MessageDialog.openInformation(getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str",connectionItem.getProperty().getDisplayName()));
    }
  }
 else {
    String mainMsg=Messages.getString("String_Node_Str");
    if (!isReadOnly()) {
      updateStatus(IStatus.WARNING,mainMsg);
    }
    if (displayDialog) {
      new ErrorDialogWidthDetailArea(getShell(),Activator.PLUGIN_ID,mainMsg,connectException);
    }
  }
  return connectionStatus;
}
Program: 125074
Project: 125074
Buggy source:
@Override public IComponentName getCorrespondingComponentName(Item item,ERepositoryObjectType type){
  RepositoryComponentSetting setting=new RepositoryComponentSetting();
  setting.setName(HDFS);
  setting.setRepositoryType(HDFS);
  setting.setWithSchema(true);
  setting.setInputComponent(INPUT);
  setting.setOutputComponent(OUTPUT);
  List<Class<Item>> list=new ArrayList<Class<Item>>();
  Class clazz=null;
  try {
    clazz=Class.forName(HDFSConnectionItem.class.getName());
  }
 catch (  ClassNotFoundException e) {
    ExceptionHandler.process(e);
  }
  list.add(clazz);
  setting.setClasses(list.toArray(new Class[0]));
  return setting;
}

Fixed version (ground truth):
@Override public IComponentName getCorrespondingComponentName(Item item,ERepositoryObjectType type){
  RepositoryComponentSetting setting=null;
  if (item instanceof HDFSConnectionItem) {
    setting=new RepositoryComponentSetting();
    setting.setName(HDFS);
    setting.setRepositoryType(HDFS);
    setting.setWithSchema(true);
    setting.setInputComponent(INPUT);
    setting.setOutputComponent(OUTPUT);
    List<Class<Item>> list=new ArrayList<Class<Item>>();
    Class clazz=null;
    try {
      clazz=Class.forName(HDFSConnectionItem.class.getName());
    }
 catch (    ClassNotFoundException e) {
      ExceptionHandler.process(e);
    }
    list.add(clazz);
    setting.setClasses(list.toArray(new Class[0]));
  }
  return setting;
}
Program: 125076
Project: 125076
Buggy source:
private boolean checkHCatalogConnection(final HCatalogConnection connection){
  final boolean[] result=new boolean[]{true};
  IRunnableWithProgress runnableWithProgress=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
      try {
        final ConnectionStatus connectionStatus=HCatalogServiceUtil.testConnection(connection);
        if (!connectionStatus.getResult()) {
          PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
            @Override public void run(){
              new ErrorDialogWidthDetailArea(PlatformUI.getWorkbench().getDisplay().getActiveShell(),Activator.PLUGIN_ID,Messages.getString("String_Node_Str"),connectionStatus.getMessageException());
              result[0]=false;
              return;
            }
          }
);
        }
      }
 catch (      Exception e) {
      }
 finally {
        monitor.done();
      }
    }
  }
;
  ProgressMonitorDialog dialog=new ProgressMonitorDialog(Display.getDefault().getActiveShell());
  try {
    dialog.run(true,true,runnableWithProgress);
  }
 catch (  Exception e) {
    result[0]=false;
    ExceptionHandler.process(e);
  }
  return result[0];
}

Fixed version (ground truth):
private boolean checkHCatalogConnection(final HCatalogConnection connection){
  final boolean[] result=new boolean[]{true};
  IRunnableWithProgress runnableWithProgress=new IRunnableWithProgress(){
    @Override public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
      try {
        final ConnectionStatus connectionStatus=HCatalogServiceUtil.testConnection(connection);
        if (!connectionStatus.getResult()) {
          PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
            @Override public void run(){
              new ErrorDialogWidthDetailArea(PlatformUI.getWorkbench().getDisplay().getActiveShell(),Activator.PLUGIN_ID,Messages.getString("String_Node_Str"),connectionStatus.getMessageException());
              result[0]=false;
              return;
            }
          }
);
        }
      }
 catch (      Exception e) {
      }
 finally {
        monitor.done();
      }
    }
  }
;
  ProgressMonitorDialog dialog=new ProgressMonitorDialog(Display.getDefault().getActiveShell());
  try {
    dialog.run(true,true,runnableWithProgress);
  }
 catch (  Exception e) {
    result[0]=false;
    ExceptionHandler.process(e);
  }
  return result[0];
}
Program: 125077
Project: 125077
Buggy source:
public void init(final IWorkbench workbench,final IStructuredSelection selection){
  this.selection=selection;
}

Fixed version (ground truth):
@Override public void init(final IWorkbench workbench,final IStructuredSelection selection){
  this.selection=selection;
}
Program: 125078
Project: 125078
Buggy source:
public void addPages(){
  setWindowTitle("String_Node_Str");
  setDefaultPageImageDescriptor(ImageProvider.getImageDesc(ECoreImage.METADATA_TABLE_WIZ));
  schemaWizardPage=new HCatalogSchemaWizardPage(selectedMetadataTable,connectionItem,isRepositoryObjectEditable(),temConnection);
  if (creation) {
    tableSelectorWizardPage=new HCatalogTableSelectorWizardPage(connectionItem,isRepositoryObjectEditable(),temConnection);
    tableSelectorWizardPage.setTitle(Messages.getString("String_Node_Str",connectionItem.getProperty().getLabel()));
    tableSelectorWizardPage.setDescription(Messages.getString("String_Node_Str"));
    tableSelectorWizardPage.setPageComplete(true);
    addPage(tableSelectorWizardPage);
    schemaWizardPage.setTitle(Messages.getString("String_Node_Str",connectionItem.getProperty().getLabel()));
    schemaWizardPage.setDescription(Messages.getString("String_Node_Str"));
    schemaWizardPage.setPageComplete(false);
    addPage(schemaWizardPage);
  }
 else {
    schemaWizardPage.setTitle(Messages.getString("String_Node_Str",connectionItem.getProperty().getLabel()));
    schemaWizardPage.setDescription(Messages.getString("String_Node_Str"));
    schemaWizardPage.setPageComplete(false);
    addPage(schemaWizardPage);
  }
}

Fixed version (ground truth):
@Override public void addPages(){
  setWindowTitle("String_Node_Str");
  setDefaultPageImageDescriptor(ImageProvider.getImageDesc(ECoreImage.METADATA_TABLE_WIZ));
  schemaWizardPage=new HCatalogSchemaWizardPage(selectedMetadataTable,connectionItem,isRepositoryObjectEditable(),temConnection);
  if (creation) {
    tableSelectorWizardPage=new HCatalogTableSelectorWizardPage(connectionItem,isRepositoryObjectEditable(),temConnection);
    tableSelectorWizardPage.setTitle(Messages.getString("String_Node_Str",connectionItem.getProperty().getLabel()));
    tableSelectorWizardPage.setDescription(Messages.getString("String_Node_Str"));
    tableSelectorWizardPage.setPageComplete(true);
    addPage(tableSelectorWizardPage);
    schemaWizardPage.setTitle(Messages.getString("String_Node_Str",connectionItem.getProperty().getLabel()));
    schemaWizardPage.setDescription(Messages.getString("String_Node_Str"));
    schemaWizardPage.setPageComplete(false);
    addPage(schemaWizardPage);
  }
 else {
    schemaWizardPage.setTitle(Messages.getString("String_Node_Str",connectionItem.getProperty().getLabel()));
    schemaWizardPage.setDescription(Messages.getString("String_Node_Str"));
    schemaWizardPage.setPageComplete(false);
    addPage(schemaWizardPage);
  }
}
Program: 125079
Project: 125079
Buggy source:
public void run(IProgressMonitor monitor) throws CoreException {
  connectionItem.setConnection(temConnection);
  saveMetaData();
  RepositoryUpdateManager.updateMultiSchema(connectionItem,oldMetadataTable,oldTableMap);
  closeLockStrategy();
  temConnection=null;
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor) throws CoreException {
  connectionItem.setConnection(temConnection);
  saveMetaData();
  RepositoryUpdateManager.updateMultiSchema(connectionItem,oldMetadataTable,oldTableMap);
  closeLockStrategy();
  temConnection=null;
}
Program: 125080
Project: 125080
Buggy source:
private void cloneBaseHCatalogConnection(HCatalogConnection connection){
  temConnection=(HCatalogConnection)EcoreUtil.copy(connection);
  EList<Package> dataPackage=connection.getDataPackage();
  Collection<Package> newDataPackage=EcoreUtil.copyAll(dataPackage);
  ConnectionHelper.addPackages(newDataPackage,temConnection);
}

Fixed version (ground truth):
private void cloneBaseHCatalogConnection(HCatalogConnection connection){
  temConnection=EcoreUtil.copy(connection);
  EList<Package> dataPackage=connection.getDataPackage();
  Collection<Package> newDataPackage=EcoreUtil.copyAll(dataPackage);
  ConnectionHelper.addPackages(newDataPackage,temConnection);
}
Program: 125081
Project: 125081
Buggy source:
public boolean performFinish(){
  if (schemaWizardPage.isPageComplete()) {
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    IWorkspaceRunnable operation=new IWorkspaceRunnable(){
      public void run(      IProgressMonitor monitor) throws CoreException {
        connectionItem.setConnection(temConnection);
        saveMetaData();
        RepositoryUpdateManager.updateMultiSchema(connectionItem,oldMetadataTable,oldTableMap);
        closeLockStrategy();
        temConnection=null;
      }
    }
;
    try {
      workspace.run(operation,null);
    }
 catch (    CoreException e) {
      ExceptionHandler.process(e);
    }
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (schemaWizardPage.isPageComplete()) {
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    IWorkspaceRunnable operation=new IWorkspaceRunnable(){
      @Override public void run(      IProgressMonitor monitor) throws CoreException {
        connectionItem.setConnection(temConnection);
        saveMetaData();
        RepositoryUpdateManager.updateMultiSchema(connectionItem,oldMetadataTable,oldTableMap);
        closeLockStrategy();
        temConnection=null;
      }
    }
;
    try {
      workspace.run(operation,null);
    }
 catch (    CoreException e) {
      ExceptionHandler.process(e);
    }
    return true;
  }
 else {
    return false;
  }
}