Program: 124704
Project: 124704
Buggy source:
public static Map<String,String> getHadoopDbParameters(HadoopClusterConnectionItem clusterItem){
  Map<String,String> parameters=new HashMap<>();
  if (clusterItem == null) {
    return parameters;
  }
  HadoopClusterConnection hcConnection=(HadoopClusterConnection)clusterItem.getConnection();
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID,clusterItem.getProperty().getId());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL,hcConnection.getNameNodeURI());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL,hcConnection.getJobTrackerURI());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USE_YARN,String.valueOf(hcConnection.isUseYarn()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USE_CUSTOM_CONFS,String.valueOf(hcConnection.isUseCustomConfs()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USE_KRB,String.valueOf(hcConnection.isEnableKerberos()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_PRINCIPAL,hcConnection.getPrincipal());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_PRINCIPAL,hcConnection.getJtOrRmPrincipal());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_JOB_HISTORY_PRINCIPAL,hcConnection.getJobHistoryPrincipal());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_RESOURCEMANAGER_SCHEDULER_ADDRESS,hcConnection.getRmScheduler());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_JOBHISTORY_ADDRESS,hcConnection.getJobHistory());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_STAGING_DIRECTORY,hcConnection.getStagingDirectory());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USE_DATANODE_HOSTNAME,String.valueOf(hcConnection.isUseDNHost()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_DB_SERVER,HadoopParameterUtil.getHostNameFromNameNodeURI(ConnectionContextHelper.getParamValueOffContext(hcConnection,hcConnection.getNameNodeURI())));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USERNAME,hcConnection.getUserName());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_DISTRIBUTION,hcConnection.getDistribution());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_VERSION,hcConnection.getDfVersion());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_DISTRIBUTION,hcConnection.getDistribution());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_VERSION,hcConnection.getDfVersion());
  if (hcConnection.isEnableKerberos()) {
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_USEKEYTAB,String.valueOf(hcConnection.isUseKeytab()));
    if (hcConnection.isUseKeytab()) {
      parameters.put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL,hcConnection.getKeytabPrincipal());
      parameters.put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB,hcConnection.getKeytab());
    }
  }
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_USE_MAPRTICKET,String.valueOf(hcConnection.isEnableMaprT()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_USE_MAPRTICKET,String.valueOf(hcConnection.isEnableMaprT()));
  if (hcConnection.isEnableMaprT()) {
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_USERNAME,hcConnection.getUserName());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_PASSWORD,hcConnection.getMaprTPassword());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_CLUSTER,hcConnection.getMaprTCluster());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_DURATION,hcConnection.getMaprTDuration());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_USERNAME,hcConnection.getUserName());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_PASSWORD,hcConnection.getMaprTPassword());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_CLUSTER,hcConnection.getMaprTCluster());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_DURATION,hcConnection.getMaprTDuration());
  }
  return parameters;
}

Fixed version (ground truth):
public static Map<String,String> getHadoopDbParameters(HadoopClusterConnectionItem clusterItem){
  Map<String,String> parameters=new HashMap<>();
  if (clusterItem == null) {
    return parameters;
  }
  HadoopClusterConnection hcConnection=(HadoopClusterConnection)clusterItem.getConnection();
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID,clusterItem.getProperty().getId());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL,hcConnection.getNameNodeURI());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL,hcConnection.getJobTrackerURI());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USE_YARN,String.valueOf(hcConnection.isUseYarn()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USE_CUSTOM_CONFS,String.valueOf(hcConnection.isUseCustomConfs()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USE_KRB,String.valueOf(hcConnection.isEnableKerberos()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_PRINCIPAL,hcConnection.getPrincipal());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_PRINCIPAL,hcConnection.getJtOrRmPrincipal());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_JOB_HISTORY_PRINCIPAL,hcConnection.getJobHistoryPrincipal());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_RESOURCEMANAGER_SCHEDULER_ADDRESS,hcConnection.getRmScheduler());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_JOBHISTORY_ADDRESS,hcConnection.getJobHistory());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_STAGING_DIRECTORY,hcConnection.getStagingDirectory());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USE_DATANODE_HOSTNAME,String.valueOf(hcConnection.isUseDNHost()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_DB_SERVER,HadoopParameterUtil.getHostNameFromNameNodeURI(ConnectionContextHelper.getParamValueOffContext(hcConnection,hcConnection.getNameNodeURI())));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_USERNAME,hcConnection.getUserName());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_DISTRIBUTION,hcConnection.getDistribution());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_VERSION,hcConnection.getDfVersion());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_DISTRIBUTION,hcConnection.getDistribution());
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_VERSION,hcConnection.getDfVersion());
  if (hcConnection.isEnableKerberos()) {
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_USEKEYTAB,String.valueOf(hcConnection.isUseKeytab()));
    if (hcConnection.isUseKeytab()) {
      parameters.put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL,hcConnection.getKeytabPrincipal());
      parameters.put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB,hcConnection.getKeytab());
    }
  }
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_USE_MAPRTICKET,String.valueOf(hcConnection.isEnableMaprT()));
  parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_USE_MAPRTICKET,String.valueOf(hcConnection.isEnableMaprT()));
  if (hcConnection.isEnableMaprT()) {
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_USERNAME,hcConnection.getUserName());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_PASSWORD,hcConnection.getMaprTPassword());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_CLUSTER,hcConnection.getMaprTCluster());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_AUTHENTICATION_MAPRTICKET_DURATION,hcConnection.getMaprTDuration());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_USERNAME,hcConnection.getUserName());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_PASSWORD,hcConnection.getMaprTPassword());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_CLUSTER,hcConnection.getMaprTCluster());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_AUTHENTICATION_MAPRTICKET_DURATION,hcConnection.getMaprTDuration());
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_MAPRTICKET_SETMAPRHOMEDIR,String.valueOf(hcConnection.isSetMaprTHomeDir()));
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_MAPRTICKET_MAPRHOMEDIR,ConnectionContextHelper.getParamValueOffContext(hcConnection,hcConnection.getMaprTHomeDir()));
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_MAPRTICKET_SETMAPRHADOOPLOGIN,String.valueOf(hcConnection.isSetHadoopLogin()));
    parameters.put(ConnParameterKeys.CONN_PARA_KEY_MAPRTICKET_MAPRHADOOPLOGIN,ConnectionContextHelper.getParamValueOffContext(hcConnection,hcConnection.getMaprTHadoopLogin()));
  }
  return parameters;
}