Program: 127768
Project: 127768
Buggy source:
/** 
 * DOC cantoine : Check connexion from IMetadataConnection comment. Detailled comment.
 * @return isValide
 */
public boolean check(IMetadataConnection metadataConnection,boolean... onlyIfNeeded){
  messageException=null;
  ConnectionStatus testConnection=null;
  if (metadataConnection == null) {
    return false;
  }
  if (onlyIfNeeded != null && onlyIfNeeded.length > 0 && onlyIfNeeded[0] == true) {
    if (metadataConnection.equals(oldConnection)) {
      return true;
    }
  }
  if (metadataConnection.getDbRootPath() != null && !metadataConnection.getDbRootPath().equals("String_Node_Str")) {
    setDbRootPath(metadataConnection.getDbRootPath());
  }
  try {
    EDatabaseTypeName type=EDatabaseTypeName.getTypeFromDbType(metadataConnection.getDbType());
    if (type.isUseProvider()) {
      IDBMetadataProvider extractorToUse=ExtractMetaDataFromDataBase.getProviderByDbType(metadataConnection.getDbType());
      if (extractorToUse != null) {
        testConnection=extractorToUse.testConnection(metadataConnection);
      }
    }
 else {
      if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
        String key=(String)metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
        if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equals(key)) {
          System.setProperty("String_Node_Str","String_Node_Str");
          System.setProperty("String_Node_Str","String_Node_Str" + metadataConnection.getServerName() + "String_Node_Str"+ metadataConnection.getPort());
        }
      }
      testConnection=ExtractMetaDataFromDataBase.testConnection(metadataConnection.getDbType(),metadataConnection.getUrl(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getSchema(),metadataConnection.getDriverClass(),metadataConnection.getDriverJarPath(),metadataConnection.getDbVersionString(),metadataConnection.getAdditionalParams());
    }
    oldConnection=metadataConnection;
    isValide=testConnection.getResult();
    messageException=testConnection.getMessageException();
  }
 catch (  Exception e) {
    log.error(Messages.getString("String_Node_Str") + "String_Node_Str" + e.toString());
  }
  return isValide;
}

Fixed version (ground truth):
/** 
 * DOC cantoine : Check connexion from IMetadataConnection comment. Detailled comment.
 * @return isValide
 */
public boolean check(IMetadataConnection metadataConnection,boolean... onlyIfNeeded){
  messageException=null;
  ConnectionStatus testConnection=null;
  if (metadataConnection == null) {
    return false;
  }
  if (onlyIfNeeded != null && onlyIfNeeded.length > 0 && onlyIfNeeded[0] == true) {
    if (metadataConnection.equals(oldConnection)) {
      return true;
    }
  }
  if (metadataConnection.getDbRootPath() != null && !metadataConnection.getDbRootPath().equals("String_Node_Str")) {
    setDbRootPath(metadataConnection.getDbRootPath());
  }
  try {
    EDatabaseTypeName type=EDatabaseTypeName.getTypeFromDbType(metadataConnection.getDbType());
    if (type.isUseProvider()) {
      IDBMetadataProvider extractorToUse=ExtractMetaDataFromDataBase.getProviderByDbType(metadataConnection.getDbType());
      if (extractorToUse != null) {
        testConnection=extractorToUse.testConnection(metadataConnection);
      }
    }
 else     if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
      String key=(String)metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
      testConnection=new ConnectionStatus();
      testConnection.setResult(false);
      try {
        if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equals(key)) {
          JavaSqlFactory.doHivePreSetup((DatabaseConnection)metadataConnection.getCurrentConnection());
        }
        HiveConnectionManager.getInstance().checkConnection(metadataConnection);
        testConnection.setResult(true);
      }
 catch (      Exception e) {
        testConnection.setResult(false);
        log.error(Messages.getString("String_Node_Str") + "String_Node_Str" + e.toString());
      }
    }
 else {
      testConnection=ExtractMetaDataFromDataBase.testConnection(metadataConnection.getDbType(),metadataConnection.getUrl(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getSchema(),metadataConnection.getDriverClass(),metadataConnection.getDriverJarPath(),metadataConnection.getDbVersionString(),metadataConnection.getAdditionalParams());
    }
    oldConnection=metadataConnection;
    isValide=testConnection.getResult();
    messageException=testConnection.getMessageException();
  }
 catch (  Exception e) {
    log.error(Messages.getString("String_Node_Str") + "String_Node_Str" + e.toString());
  }
  return isValide;
}