Program: 127952
Project: 127952
Buggy source:
@Override protected void run() throws LoginException, PersistenceException {
  monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
  if (!monitor.isCanceled()) {
    final ManagerConnection managerConnection=new ManagerConnection();
    DatabaseConnection connection=(DatabaseConnection)item.getConnection();
    IMetadataConnection metadataConnection=ConvertionHelper.convert(connection);
    if (!metadataConnection.getDbType().equals(EDatabaseConnTemplate.GODBC.getDBDisplayName()) && !metadataConnection.getDbType().equals(EDatabaseConnTemplate.ACCESS.getDBDisplayName()) && !metadataConnection.getDbType().equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())) {
      String hiveMode=(String)metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
      if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType()) && HiveConnVersionInfo.MODE_EMBEDDED.getKey().equals(hiveMode)) {
        metadataConnection.setUrl(connection.getURL());
        JavaSqlFactory.doHivePreSetup(connection);
      }
 else {
        String genUrl=DatabaseConnStrUtil.getURLString(metadataConnection.getDbType(),metadataConnection.getDbVersionString(),metadataConnection.getServerName(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getPort(),metadataConnection.getDatabase(),metadataConnection.getFileFieldName(),metadataConnection.getDataSourceName(),metadataConnection.getDbRootPath(),metadataConnection.getAdditionalParams());
        metadataConnection.setUrl(genUrl);
      }
    }
    if (connection != null) {
      EList<orgomg.cwm.objectmodel.core.Package> dp=connection.getDataPackage();
      Collection<Package> newDataPackage=EcoreUtil.copyAll(dp);
      ConnectionHelper.addPackages(newDataPackage,(DatabaseConnection)metadataConnection.getCurrentConnection());
    }
    if (creation) {
      String hiveMode=(String)metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
      if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType()) && HiveConnVersionInfo.MODE_EMBEDDED.getKey().equals(hiveMode)) {
        try {
          HiveConnectionManager.getInstance().checkConnection(metadataConnection);
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
 else {
        managerConnection.check(metadataConnection);
      }
      ExtractMetaDataUtils.setUseAllSynonyms(false);
      DatabaseTableWizard databaseTableWizard=new DatabaseTableWizard(PlatformUI.getWorkbench(),creation,node.getObject(),metadataTable,getExistingNames(),forceReadOnly,managerConnection,metadataConnection);
      WizardDialog wizardDialog=new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),databaseTableWizard);
      wizardDialog.setBlockOnOpen(true);
      handleWizard(node,wizardDialog);
    }
 else {
      final boolean skipStep=true;
      DatabaseTableWizard databaseTableWizard=new DatabaseTableWizard(PlatformUI.getWorkbench(),creation,node.getObject(),metadataTable,getExistingNames(),forceReadOnly,managerConnection,metadataConnection);
      databaseTableWizard.setSkipStep(skipStep);
      WizardDialog wizardDialog=new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),databaseTableWizard);
      handleWizard(node,wizardDialog);
    }
  }
}

Fixed version (ground truth):
@Override protected void run() throws LoginException, PersistenceException {
  monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
  if (!monitor.isCanceled()) {
    final ManagerConnection managerConnection=new ManagerConnection();
    DatabaseConnection connection=(DatabaseConnection)item.getConnection();
    IMetadataConnection metadataConnection=ConvertionHelper.convert(connection);
    if (!metadataConnection.getDbType().equals(EDatabaseConnTemplate.GODBC.getDBDisplayName()) && !metadataConnection.getDbType().equals(EDatabaseConnTemplate.ACCESS.getDBDisplayName()) && !metadataConnection.getDbType().equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())) {
      String hiveMode=(String)metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
      if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
        metadataConnection.setUrl(connection.getURL());
        if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equals(hiveMode)) {
          JavaSqlFactory.doHivePreSetup(connection);
        }
      }
 else {
        String genUrl=DatabaseConnStrUtil.getURLString(metadataConnection.getDbType(),metadataConnection.getDbVersionString(),metadataConnection.getServerName(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getPort(),metadataConnection.getDatabase(),metadataConnection.getFileFieldName(),metadataConnection.getDataSourceName(),metadataConnection.getDbRootPath(),metadataConnection.getAdditionalParams());
        metadataConnection.setUrl(genUrl);
      }
    }
    if (connection != null) {
      EList<orgomg.cwm.objectmodel.core.Package> dp=connection.getDataPackage();
      Collection<Package> newDataPackage=EcoreUtil.copyAll(dp);
      ConnectionHelper.addPackages(newDataPackage,(DatabaseConnection)metadataConnection.getCurrentConnection());
    }
    if (creation) {
      String hiveMode=(String)metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
      if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
        try {
          HiveConnectionManager.getInstance().checkConnection(metadataConnection);
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
 else {
        managerConnection.check(metadataConnection);
      }
      ExtractMetaDataUtils.setUseAllSynonyms(false);
      DatabaseTableWizard databaseTableWizard=new DatabaseTableWizard(PlatformUI.getWorkbench(),creation,node.getObject(),metadataTable,getExistingNames(),forceReadOnly,managerConnection,metadataConnection);
      WizardDialog wizardDialog=new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),databaseTableWizard);
      wizardDialog.setBlockOnOpen(true);
      handleWizard(node,wizardDialog);
    }
 else {
      final boolean skipStep=true;
      DatabaseTableWizard databaseTableWizard=new DatabaseTableWizard(PlatformUI.getWorkbench(),creation,node.getObject(),metadataTable,getExistingNames(),forceReadOnly,managerConnection,metadataConnection);
      databaseTableWizard.setSkipStep(skipStep);
      WizardDialog wizardDialog=new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),databaseTableWizard);
      handleWizard(node,wizardDialog);
    }
  }
}