Program: 118278
Project: 118278
Buggy source:
/** 
 * qzhang Comment method "checkConnection".
 * @param metadataConnection
 */
protected boolean checkConnection(IMetadataConnection metadataConnection){
  try {
    if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
      ConnectionStatus connectionStatus=new ConnectionStatus();
      connectionStatus.setResult(false);
      try {
        if (HiveModeInfo.get(metadataConnection.getDbVersionString()) == HiveModeInfo.EMBEDDED) {
          JavaSqlFactory.doHivePreSetup((DatabaseConnection)metadataConnection.getCurrentConnection());
        }
        HiveConnectionManager.getInstance().checkConnection(metadataConnection);
        connectionStatus.setResult(true);
      }
 catch (      Exception e) {
        log.error("String_Node_Str" + "String_Node_Str" + e.toString());
      }
      return connectionStatus.getResult();
    }
    ConnectionStatus testConnection=ExtractMetaDataFromDataBase.testConnection(metadataConnection.getDbType(),metadataConnection.getUrl(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getSchema(),metadataConnection.getDriverClass(),metadataConnection.getDriverJarPath(),metadataConnection.getDbVersionString(),metadataConnection.getAdditionalParams());
    connParameters.setConnectionComment(testConnection.getMessageException());
    return testConnection.getResult();
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + "String_Node_Str" + e.toString());
  }
  return false;
}

Fixed version (ground truth):
/** 
 * qzhang Comment method "checkConnection".
 * @param metadataConnection
 */
protected boolean checkConnection(IMetadataConnection metadataConnection){
  try {
    if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
      ConnectionStatus connectionStatus=new ConnectionStatus();
      connectionStatus.setResult(false);
      try {
        if (HiveModeInfo.get(metadataConnection.getDbVersionString()) == HiveModeInfo.EMBEDDED) {
          JavaSqlFactory.doHivePreSetup((DatabaseConnection)metadataConnection.getCurrentConnection());
        }
        HiveConnectionManager.getInstance().checkConnection(metadataConnection);
        connectionStatus.setResult(true);
      }
 catch (      Exception e) {
        log.error("String_Node_Str" + "String_Node_Str" + e.toString());
      }
      return connectionStatus.getResult();
    }
    if (EDatabaseTypeName.IMPALA.getDisplayName().equals(metadataConnection.getDbType())) {
      ConnectionStatus connectionStatus=new ConnectionStatus();
      connectionStatus.setResult(false);
      try {
        ImpalaConnectionManager.getInstance().checkConnection(metadataConnection);
        connectionStatus.setResult(true);
      }
 catch (      Exception e) {
        log.error("String_Node_Str" + "String_Node_Str" + e.toString());
      }
      return connectionStatus.getResult();
    }
    ConnectionStatus testConnection=ExtractMetaDataFromDataBase.testConnection(metadataConnection.getDbType(),metadataConnection.getUrl(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getSchema(),metadataConnection.getDriverClass(),metadataConnection.getDriverJarPath(),metadataConnection.getDbVersionString(),metadataConnection.getAdditionalParams());
    connParameters.setConnectionComment(testConnection.getMessageException());
    return testConnection.getResult();
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + "String_Node_Str" + e.toString());
  }
  return false;
}