Program: 128693
Project: 128693
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();
    if (EDatabaseTypeName.HIVE.getDisplayName().equals(dbTypeCombo.getText())) {
      EDatabaseVersion4Drivers driver=EDatabaseVersion4Drivers.indexOfByVersionDisplay(hiveModeCombo.getText());
      versionStr=driver.getVersionValue();
    }
 else {
      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());
  if (isHiveDBConnSelected()) {
    if (isHiveEmbeddedMode()) {
      Map<String,String> properties=new HashMap<String,String>();
      properties.put(ConnParameterKeys.CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR,metastoreConnDriverJar.getText());
      properties.put("String_Node_Str",dbTypeCombo.getItem(dbTypeCombo.getSelectionIndex()));
      properties.put("String_Node_Str",metastoreConnURLTxt.getText());
      properties.put("String_Node_Str",metastoreConnUserName.getText());
      properties.put("String_Node_Str",metastoreConnPassword.getText());
      properties.put("String_Node_Str",metastoreConnDriverName.getText());
      properties.put("String_Node_Str","String_Node_Str");
      properties.put("String_Node_Str","String_Node_Str");
      databaseSettingIsValide=managerConnection.checkForHive(properties);
    }
  }
 else {
    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()) {
    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();
    if (EDatabaseTypeName.HIVE.getDisplayName().equals(dbTypeCombo.getText())) {
      EDatabaseVersion4Drivers driver=EDatabaseVersion4Drivers.indexOfByVersionDisplay(hiveModeCombo.getText());
      versionStr=driver.getVersionValue();
    }
 else {
      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());
  if (isHiveDBConnSelected() && isHiveEmbeddedMode()) {
    Map<String,String> properties=new HashMap<String,String>();
    properties.put(ConnParameterKeys.CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR,metastoreConnDriverJar.getText());
    properties.put("String_Node_Str",dbTypeCombo.getItem(dbTypeCombo.getSelectionIndex()));
    properties.put("String_Node_Str",metastoreConnURLTxt.getText());
    properties.put("String_Node_Str",metastoreConnUserName.getText());
    properties.put("String_Node_Str",metastoreConnPassword.getText());
    properties.put("String_Node_Str",metastoreConnDriverName.getText());
    properties.put("String_Node_Str","String_Node_Str");
    properties.put("String_Node_Str","String_Node_Str");
    databaseSettingIsValide=managerConnection.checkForHive(properties);
  }
 else {
    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());
  }
}