Program: 128446
Project: 128446
Buggy source:
/** 
 * This method is called when 'Finish' button is pressed in the wizard. Save metadata close Lock Strategy and close wizard.
 */
@Override public boolean performFinish(){
  if (databaseWizardPage.isPageComplete()) {
    EDatabaseTypeName dbType=EDatabaseTypeName.getTypeFromDbType(connection.getDatabaseType());
    if (dbType != EDatabaseTypeName.GENERAL_JDBC) {
      String driverClass=ExtractMetaDataUtils.getDriverClassByDbType(connection.getDatabaseType());
      if (EDatabaseTypeName.VERTICA.equals(dbType) && EDatabaseVersion4Drivers.VERTICA_6.getVersionValue().equals(connection.getDbVersionString())) {
        driverClass=EDatabase4DriverClassName.VERTICA2.getDriverClass();
      }
      ((DatabaseConnection)connectionItem.getConnection()).setDriverClass(driverClass);
    }
    String contextName=null;
    if (databaseWizardPage.getSelectedContextType() != null) {
      contextName=databaseWizardPage.getSelectedContextType().getName();
    }
    IMetadataConnection metadataConnection=null;
    if (contextName == null) {
      metadataConnection=ConvertionHelper.convert(connection,true);
    }
 else {
      metadataConnection=ConvertionHelper.convert(connection,false,contextName);
    }
    final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
    ITDQRepositoryService tdqRepService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
      tdqRepService=(ITDQRepositoryService)GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
    }
    try {
      if (creation) {
        String nextId=factory.getNextId();
        connectionProperty.setId(nextId);
        if (connectionItem.getConnection() instanceof DatabaseConnection) {
          DatabaseConnection c=(DatabaseConnection)connectionItem.getConnection();
          final boolean equals=c.getProductId().equals(EDatabaseTypeName.ORACLEFORSID.getProduct());
          if (equals && !c.isContextMode()) {
            if (c.getUiSchema() == null) {
              c.setUiSchema("String_Node_Str");
            }
 else {
              c.setUiSchema(c.getUiSchema().toUpperCase());
            }
          }
        }
        EDatabaseTypeName type=EDatabaseTypeName.getTypeFromDbType(metadataConnection.getDbType());
        if (!type.equals(EDatabaseTypeName.GENERAL_JDBC)) {
          this.connection.setDriverClass(EDatabase4DriverClassName.getDriverClassByDbType(metadataConnection.getDbType()));
        }
        String displayName=connectionProperty.getDisplayName();
        connectionProperty.setLabel(displayName);
        this.connection.setName(displayName);
        this.connection.setLabel(displayName);
        if (tdqRepService != null) {
          tdqRepService.checkUsernameBeforeSaveConnection(connectionItem);
        }
        factory.create(connectionItem,propertiesWizardPage.getDestinationPath());
        ConnectionHelper.setUsingURL(connection,connection.getURL());
        ConnectionHelper.setPackageFilter(connection,"String_Node_Str");
        MetadataConnectionUtils.fillConnectionInformation(connectionItem);
        List<Catalog> catalogs=ConnectionHelper.getCatalogs(connection);
        List<Schema> schemas=ConnectionHelper.getSchema(connection);
        if (catalogs.isEmpty() && schemas.isEmpty()) {
          IDBMetadataProvider extractor=ExtractMetaDataFromDataBase.getProviderByDbType(metadataConnection.getDbType());
          if (extractor != null && type.isUseProvider()) {
            extractor.fillConnection(connection);
            factory.save(connectionItem);
          }
        }
      }
 else {
        if (connectionItem.getConnection() instanceof DatabaseConnection) {
          DatabaseConnection conn=(DatabaseConnection)connectionItem.getConnection();
          ReturnCode reloadCheck=new ReturnCode(false);
          if (tdqRepService != null && ConnectionHelper.isUrlChanged(conn)) {
            reloadCheck=openConfirmReloadConnectionDialog(Display.getCurrent().getActiveShell());
            if (!reloadCheck.isOk()) {
              return false;
            }
          }
          final boolean isOracle=EDatabaseTypeName.ORACLEFORSID.getProduct().equals(conn.getProductId());
          if (isOracle && !conn.isContextMode()) {
            if (conn.getUiSchema() != null && !"String_Node_Str".equals(conn.getUiSchema())) {
              conn.setUiSchema(conn.getUiSchema().toUpperCase());
            }
          }
          if (reloadCheck.isOk()) {
            if (needReload(reloadCheck.getMessage())) {
              if (tdqRepService != null) {
                ReturnCode retCode=tdqRepService.reloadDatabase(connectionItem);
                if (!retCode.isOk()) {
                  return Boolean.FALSE;
                }
              }
            }
          }
 else {
            DatabaseConnection dbConn=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(conn);
            if (dbConn != null && dbConn instanceof DatabaseConnection) {
              updateConnectionInformation(dbConn,metadataConnection);
            }
          }
          RepositoryUpdateManager.updateDBConnection(connectionItem);
        }
        connectionProperty.setLabel(connectionProperty.getDisplayName());
        this.connection.setName(connectionProperty.getDisplayName());
        this.connection.setLabel(connectionProperty.getDisplayName());
        boolean isNameModified=propertiesWizardPage.isNameModifiedByUser();
        if (isNameModified && tdqRepService != null) {
          tdqRepService.saveConnectionWithDependency(connectionItem);
          closeLockStrategy();
        }
 else {
          updateConnectionItem();
        }
        if (isNameModified) {
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
            IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
            if (service != null) {
              service.refreshComponentView(connectionItem);
            }
          }
        }
      }
    }
 catch (    Exception e) {
      String detailError=e.toString();
      new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str"),detailError);
      log.error(Messages.getString("String_Node_Str") + "String_Node_Str" + detailError);
      return false;
    }
    List<IRepositoryViewObject> list=new ArrayList<IRepositoryViewObject>();
    list.add(repositoryObject);
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRepositoryService.class)) {
      IRepositoryService service=(IRepositoryService)GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
      service.notifySQLBuilder(list);
    }
    if (tdqRepService != null) {
      if (creation) {
        tdqRepService.notifySQLExplorer(connectionItem);
        tdqRepService.openConnectionEditor(connectionItem);
      }
 else {
        tdqRepService.removeAliasInSQLExplorer(node);
        tdqRepService.notifySQLExplorer(connectionItem);
        tdqRepService.refreshConnectionEditor(connectionItem);
      }
      if (CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {
        tdqRepService.refresh(node.getParent());
      }
    }
    updateTdqDependencies();
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * This method is called when 'Finish' button is pressed in the wizard. Save metadata close Lock Strategy and close wizard.
 */
@Override public boolean performFinish(){
  if (databaseWizardPage.isPageComplete()) {
    EDatabaseTypeName dbType=EDatabaseTypeName.getTypeFromDbType(connection.getDatabaseType());
    if (dbType != EDatabaseTypeName.GENERAL_JDBC) {
      String driverClass=ExtractMetaDataUtils.getDriverClassByDbType(connection.getDatabaseType());
      if (EDatabaseTypeName.VERTICA.equals(dbType) && EDatabaseVersion4Drivers.VERTICA_6.getVersionValue().equals(connection.getDbVersionString())) {
        driverClass=EDatabase4DriverClassName.VERTICA2.getDriverClass();
      }
      ((DatabaseConnection)connectionItem.getConnection()).setDriverClass(driverClass);
    }
    String contextName=null;
    if (databaseWizardPage.getSelectedContextType() != null) {
      contextName=databaseWizardPage.getSelectedContextType().getName();
    }
    IMetadataConnection metadataConnection=null;
    if (contextName == null) {
      metadataConnection=ConvertionHelper.convert(connection,true);
    }
 else {
      metadataConnection=ConvertionHelper.convert(connection,false,contextName);
    }
    final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
    ITDQRepositoryService tdqRepService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
      tdqRepService=(ITDQRepositoryService)GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
    }
    try {
      if (creation) {
        String nextId=factory.getNextId();
        connectionProperty.setId(nextId);
        if (connectionItem.getConnection() instanceof DatabaseConnection) {
          DatabaseConnection c=(DatabaseConnection)connectionItem.getConnection();
          final boolean equals=c.getProductId().equals(EDatabaseTypeName.ORACLEFORSID.getProduct());
          if (equals && !c.isContextMode()) {
            if (c.getUiSchema() == null) {
              c.setUiSchema("String_Node_Str");
            }
 else {
              c.setUiSchema(c.getUiSchema().toUpperCase());
            }
          }
        }
        EDatabaseTypeName type=EDatabaseTypeName.getTypeFromDbType(metadataConnection.getDbType());
        if (!type.equals(EDatabaseTypeName.GENERAL_JDBC)) {
          this.connection.setDriverClass(EDatabase4DriverClassName.getDriverClassByDbType(metadataConnection.getDbType()));
        }
        String displayName=connectionProperty.getDisplayName();
        connectionProperty.setLabel(displayName);
        this.connection.setName(displayName);
        this.connection.setLabel(displayName);
        if (tdqRepService != null) {
          tdqRepService.checkUsernameBeforeSaveConnection(connectionItem);
        }
        factory.create(connectionItem,propertiesWizardPage.getDestinationPath());
        ConnectionHelper.setUsingURL(connection,connection.getURL());
        ConnectionHelper.setPackageFilter(connection,"String_Node_Str");
        MetadataConnectionUtils.fillConnectionInformation(connectionItem,metadataConnection);
        List<Catalog> catalogs=ConnectionHelper.getCatalogs(connection);
        List<Schema> schemas=ConnectionHelper.getSchema(connection);
        if (catalogs.isEmpty() && schemas.isEmpty()) {
          IDBMetadataProvider extractor=ExtractMetaDataFromDataBase.getProviderByDbType(metadataConnection.getDbType());
          if (extractor != null && type.isUseProvider()) {
            extractor.fillConnection(connection);
            factory.save(connectionItem);
          }
        }
      }
 else {
        if (connectionItem.getConnection() instanceof DatabaseConnection) {
          DatabaseConnection conn=(DatabaseConnection)connectionItem.getConnection();
          ReturnCode reloadCheck=new ReturnCode(false);
          if (tdqRepService != null && ConnectionHelper.isUrlChanged(conn)) {
            reloadCheck=openConfirmReloadConnectionDialog(Display.getCurrent().getActiveShell());
            if (!reloadCheck.isOk()) {
              return false;
            }
          }
          final boolean isOracle=EDatabaseTypeName.ORACLEFORSID.getProduct().equals(conn.getProductId());
          if (isOracle && !conn.isContextMode()) {
            if (conn.getUiSchema() != null && !"String_Node_Str".equals(conn.getUiSchema())) {
              conn.setUiSchema(conn.getUiSchema().toUpperCase());
            }
          }
          if (reloadCheck.isOk()) {
            if (needReload(reloadCheck.getMessage())) {
              if (tdqRepService != null) {
                ReturnCode retCode=tdqRepService.reloadDatabase(connectionItem);
                if (!retCode.isOk()) {
                  return Boolean.FALSE;
                }
              }
            }
          }
 else {
            DatabaseConnection dbConn=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(conn);
            if (dbConn != null && dbConn instanceof DatabaseConnection) {
              updateConnectionInformation(dbConn,metadataConnection);
            }
          }
          RepositoryUpdateManager.updateDBConnection(connectionItem);
        }
        connectionProperty.setLabel(connectionProperty.getDisplayName());
        this.connection.setName(connectionProperty.getDisplayName());
        this.connection.setLabel(connectionProperty.getDisplayName());
        boolean isNameModified=propertiesWizardPage.isNameModifiedByUser();
        if (isNameModified && tdqRepService != null) {
          tdqRepService.saveConnectionWithDependency(connectionItem);
          closeLockStrategy();
        }
 else {
          updateConnectionItem();
        }
        if (isNameModified) {
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
            IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
            if (service != null) {
              service.refreshComponentView(connectionItem);
            }
          }
        }
      }
    }
 catch (    Exception e) {
      String detailError=e.toString();
      new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str"),detailError);
      log.error(Messages.getString("String_Node_Str") + "String_Node_Str" + detailError);
      return false;
    }
    List<IRepositoryViewObject> list=new ArrayList<IRepositoryViewObject>();
    list.add(repositoryObject);
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRepositoryService.class)) {
      IRepositoryService service=(IRepositoryService)GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
      service.notifySQLBuilder(list);
    }
    if (tdqRepService != null) {
      if (creation) {
        tdqRepService.notifySQLExplorer(connectionItem);
        tdqRepService.openConnectionEditor(connectionItem);
      }
 else {
        tdqRepService.removeAliasInSQLExplorer(node);
        tdqRepService.notifySQLExplorer(connectionItem);
        tdqRepService.refreshConnectionEditor(connectionItem);
      }
      if (CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {
        tdqRepService.refresh(node.getParent());
      }
    }
    updateTdqDependencies();
    return true;
  }
 else {
    return false;
  }
}