Program: 129608
Project: 129608
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());
      ((DatabaseConnection)connectionItem.getConnection()).setDriverClass(driverClass);
    }
    IMetadataConnection metadataConnection=ConvertionHelper.convert(connection);
    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);
        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());
            }
          }
          RepositoryUpdateManager.updateDBConnection(connectionItem);
          if (reloadCheck.isOk()) {
            if (needReload(reloadCheck.getMessage())) {
              if (tdqRepService != null) {
                tdqRepService.reloadDatabase(connectionItem);
              }
            }
 else {
              ConnectionHelper.setUsingURL(this.connection,this.connection.getURL());
              relpacePackageName(this.connection);
            }
          }
 else {
            DatabaseConnection dbConn=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(conn);
            if (dbConn != null && dbConn instanceof DatabaseConnection) {
              updateConnectionInformation(dbConn);
            }
          }
        }
        connectionProperty.setLabel(connectionProperty.getDisplayName());
        this.connection.setName(connectionProperty.getDisplayName());
        this.connection.setLabel(connectionProperty.getDisplayName());
        IWorkspace workspace=ResourcesPlugin.getWorkspace();
        IWorkspaceRunnable operation=new IWorkspaceRunnable(){
          public void run(          IProgressMonitor monitor) throws CoreException {
            try {
              factory.save(connectionItem);
            }
 catch (            PersistenceException e) {
              e.printStackTrace();
            }
          }
        }
;
        workspace.run(operation,null);
        boolean isModified=propertiesWizardPage.isNameModifiedByUser();
        if (isModified) {
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
            IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
            if (service != null) {
              service.refreshComponentView(connectionItem);
            }
          }
        }
        closeLockStrategy();
      }
    }
 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) {
      tdqRepService.notifySQLExplorer(connectionItem);
      if (CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {
        tdqRepService.openEditor(connectionItem);
        tdqRepService.refresh();
      }
    }
    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());
      ((DatabaseConnection)connectionItem.getConnection()).setDriverClass(driverClass);
    }
    IMetadataConnection metadataConnection=ConvertionHelper.convert(connection);
    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);
        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());
            }
          }
          RepositoryUpdateManager.updateDBConnection(connectionItem);
          if (reloadCheck.isOk()) {
            if (needReload(reloadCheck.getMessage())) {
              if (tdqRepService != null) {
                tdqRepService.reloadDatabase(connectionItem);
              }
            }
 else {
              ConnectionHelper.setUsingURL(this.connection,this.connection.getURL());
              relpacePackageName(this.connection);
            }
          }
 else {
            DatabaseConnection dbConn=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(conn);
            if (dbConn != null && dbConn instanceof DatabaseConnection) {
              updateConnectionInformation(dbConn);
            }
          }
        }
        connectionProperty.setLabel(connectionProperty.getDisplayName());
        this.connection.setName(connectionProperty.getDisplayName());
        this.connection.setLabel(connectionProperty.getDisplayName());
        updateConnectionItem();
        boolean isModified=propertiesWizardPage.isNameModifiedByUser();
        if (isModified) {
          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) {
      tdqRepService.notifySQLExplorer(connectionItem);
      if (CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {
        tdqRepService.openEditor(connectionItem);
        tdqRepService.refresh();
      }
    }
    updateTdqDependencies();
    return true;
  }
 else {
    return false;
  }
}