Program: 128508
Project: 128508
Buggy source:
/** 
 * Check data connection.
 */
private void checkConnection(){
  checkButton.setEnabled(false);
  if (connectionItem.getConnection() instanceof DatabaseConnection) {
    DatabaseConnection c=(DatabaseConnection)connectionItem.getConnection();
    if (EDatabaseTypeName.ORACLEFORSID.getProduct().equals(c.getProductId())) {
      if (!isContextMode()) {
        schemaText.setText(schemaText.getText().toUpperCase());
      }
    }
  }
  ManagerConnection managerConnection=new ManagerConnection();
  if (isContextMode()) {
    String urlStr=DBConnectionContextUtils.setManagerConnectionValues(managerConnection,connectionItem,dbTypeCombo.getItem(dbTypeCombo.getSelectionIndex()),dbTypeCombo.getSelectionIndex());
    if (urlStr == null) {
      if (dbTypeCombo.getText().equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())) {
        DatabaseConnection dbConn=(DatabaseConnection)connectionItem.getConnection();
        ContextType contextType=ConnectionContextHelper.getContextTypeForContextMode(dbConn);
        urlStr=ConnectionContextHelper.getOriginalValue(contextType,dbConn.getURL());
      }
 else {
        urlStr=getStringConnection();
      }
    }
    urlConnectionStringText.setText(urlStr);
  }
 else {
    String versionStr=dbVersionCombo.getText();
    EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(versionStr);
    if (version != null) {
      versionStr=version.getVersionValue();
    }
    managerConnection.setValue(0,dbTypeCombo.getItem(dbTypeCombo.getSelectionIndex()),isGeneralJDBC() ? generalJdbcUrlText.getText() : urlConnectionStringText.getText(),serverText.getText(),isGeneralJDBC() ? generalJdbcUserText.getText() : usernameText.getText(),isGeneralJDBC() ? generalJdbcPasswordText.getText() : passwordText.getText(),sidOrDatabaseText.getText(),portText.getText(),fileField.getText(),datasourceText.getText(),isGeneralJDBC() ? jDBCschemaText.getText() : schemaText.getText(),additionParamText.getText(),generalJdbcClassNameText.getText(),generalJdbcDriverjarText.getText(),enableDbVersion() ? versionStr : null);
    managerConnection.setDbRootPath(directoryField.getText());
  }
  managerConnection.setValueProperties(sqlSyntaxCombo.getItem(sqlSyntaxCombo.getSelectionIndex()),stringQuoteText.getText(),nullCharText.getText());
  databaseSettingIsValide=managerConnection.check();
  checkButton.setEnabled(true);
  if (databaseSettingIsValide) {
    if (!isReadOnly()) {
      updateStatus(IStatus.OK,null);
    }
    MessageDialog.openInformation(getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + connectionItem.getProperty().getDisplayName() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
    if (!isReadOnly()) {
      if (isContextMode()) {
        adaptFormToEditable();
      }
 else {
        setPropertiesFormEditable(true);
      }
    }
    String msg=checkDBVersion();
    if (msg != null) {
      updateStatus(IStatus.WARNING,msg);
    }
  }
 else {
    String mainMsg=Messages.getString("String_Node_Str") + "String_Node_Str" + Messages.getString("String_Node_Str");
    if (!isReadOnly()) {
      updateStatus(IStatus.WARNING,mainMsg);
    }
    new ErrorDialogWidthDetailArea(getShell(),PID,mainMsg,managerConnection.getMessageException());
  }
}

Fixed version (ground truth):
/** 
 * Check data connection.
 */
private void checkConnection(){
  checkButton.setEnabled(false);
  if (connectionItem.getConnection() instanceof DatabaseConnection) {
    DatabaseConnection c=(DatabaseConnection)connectionItem.getConnection();
    if (EDatabaseTypeName.ORACLEFORSID.getProduct().equals(c.getProductId())) {
      if (!isContextMode()) {
        schemaText.setText(schemaText.getText().toUpperCase());
      }
    }
  }
  ManagerConnection managerConnection=new ManagerConnection();
  if (isContextMode()) {
    selectedContextType=ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection());
    String urlStr=DBConnectionContextUtils.setManagerConnectionValues(managerConnection,connectionItem,selectedContextType,dbTypeCombo.getItem(dbTypeCombo.getSelectionIndex()),dbTypeCombo.getSelectionIndex());
    if (urlStr == null) {
      if (dbTypeCombo.getText().equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())) {
        DatabaseConnection dbConn=(DatabaseConnection)connectionItem.getConnection();
        urlStr=ConnectionContextHelper.getOriginalValue(selectedContextType,dbConn.getURL());
      }
 else {
        urlStr=getStringConnection();
      }
    }
    urlConnectionStringText.setText(urlStr);
  }
 else {
    String versionStr=dbVersionCombo.getText();
    EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(versionStr);
    if (version != null) {
      versionStr=version.getVersionValue();
    }
    managerConnection.setValue(0,dbTypeCombo.getItem(dbTypeCombo.getSelectionIndex()),isGeneralJDBC() ? generalJdbcUrlText.getText() : urlConnectionStringText.getText(),serverText.getText(),isGeneralJDBC() ? generalJdbcUserText.getText() : usernameText.getText(),isGeneralJDBC() ? generalJdbcPasswordText.getText() : passwordText.getText(),sidOrDatabaseText.getText(),portText.getText(),fileField.getText(),datasourceText.getText(),isGeneralJDBC() ? jDBCschemaText.getText() : schemaText.getText(),additionParamText.getText(),generalJdbcClassNameText.getText(),generalJdbcDriverjarText.getText(),enableDbVersion() ? versionStr : null);
    managerConnection.setDbRootPath(directoryField.getText());
  }
  managerConnection.setValueProperties(sqlSyntaxCombo.getItem(sqlSyntaxCombo.getSelectionIndex()),stringQuoteText.getText(),nullCharText.getText());
  databaseSettingIsValide=managerConnection.check();
  checkButton.setEnabled(true);
  if (databaseSettingIsValide) {
    if (!isReadOnly()) {
      updateStatus(IStatus.OK,null);
    }
    MessageDialog.openInformation(getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + connectionItem.getProperty().getDisplayName() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
    if (!isReadOnly()) {
      if (isContextMode()) {
        adaptFormToEditable();
      }
 else {
        setPropertiesFormEditable(true);
      }
    }
    String msg=checkDBVersion();
    if (msg != null) {
      updateStatus(IStatus.WARNING,msg);
    }
  }
 else {
    String mainMsg=Messages.getString("String_Node_Str") + "String_Node_Str" + Messages.getString("String_Node_Str");
    if (!isReadOnly()) {
      updateStatus(IStatus.WARNING,mainMsg);
    }
    new ErrorDialogWidthDetailArea(getShell(),PID,mainMsg,managerConnection.getMessageException());
  }
}