Program: 124881
Project: 124881
Buggy source:
/** 
 * DOC ycbai Comment method "getHadoopDbParameters". Get db connection(like hbase, hive) parameters by hadoop cluster.
 * @param clusterId
 * @return
 */
public static Map<String,String> getHadoopDbParameters(String clusterId){
  Map<String,String> map=new HashMap<String,String>();
  HadoopClusterConnectionItem clusterItem=HCRepositoryUtil.getRelativeHadoopClusterItem(clusterId);
  if (clusterItem != null) {
    HadoopClusterConnection hcConnection=(HadoopClusterConnection)clusterItem.getConnection();
    map.put(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID,clusterItem.getProperty().getId());
    map.put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL,hcConnection.getNameNodeURI());
    map.put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL,hcConnection.getJobTrackerURI());
    map.put(ConnParameterKeys.CONN_PARA_KEY_USE_YARN,String.valueOf(hcConnection.isUseYarn()));
    map.put(ConnParameterKeys.CONN_PARA_KEY_USE_KRB,String.valueOf(hcConnection.isEnableKerberos()));
    map.put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_PRINCIPAL,hcConnection.getPrincipal());
    map.put(ConnParameterKeys.CONN_PARA_KEY_DB_SERVER,HadoopParameterUtil.getHostNameFromNameNodeURI(hcConnection.getNameNodeURI()));
    map.put(ConnParameterKeys.CONN_PARA_KEY_USERNAME,hcConnection.getUserName());
    map.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_DISTRIBUTION,hcConnection.getDistribution());
    map.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_VERSION,hcConnection.getDfVersion());
    map.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_DISTRIBUTION,hcConnection.getDistribution());
    map.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_VERSION,hcConnection.getDfVersion());
    if (hcConnection.isEnableKerberos()) {
      map.put(ConnParameterKeys.CONN_PARA_KEY_USEKEYTAB,String.valueOf(hcConnection.isUseKeytab()));
      if (hcConnection.isUseKeytab()) {
        map.put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL,hcConnection.getKeytabPrincipal());
        map.put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB,hcConnection.getKeytab());
      }
    }
  }
  return map;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getHadoopDbParameters". Get db connection(like hbase, hive) parameters by hadoop cluster.
 * @param clusterId
 * @return
 */
public static Map<String,String> getHadoopDbParameters(String clusterId){
  Map<String,String> map=new HashMap<String,String>();
  HadoopClusterConnectionItem clusterItem=HCRepositoryUtil.getRelativeHadoopClusterItem(clusterId);
  if (clusterItem != null) {
    HadoopClusterConnection hcConnection=(HadoopClusterConnection)clusterItem.getConnection();
    map.put(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID,clusterItem.getProperty().getId());
    map.put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL,hcConnection.getNameNodeURI());
    map.put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL,hcConnection.getJobTrackerURI());
    map.put(ConnParameterKeys.CONN_PARA_KEY_USE_YARN,String.valueOf(hcConnection.isUseYarn()));
    map.put(ConnParameterKeys.CONN_PARA_KEY_USE_KRB,String.valueOf(hcConnection.isEnableKerberos()));
    map.put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_PRINCIPAL,hcConnection.getPrincipal());
    map.put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_PRINCIPAL,hcConnection.getJtOrRmPrincipal());
    map.put(ConnParameterKeys.CONN_PARA_KEY_JOB_HISTORY_PRINCIPAL,hcConnection.getJobHistoryPrincipal());
    map.put(ConnParameterKeys.CONN_PARA_KEY_DB_SERVER,HadoopParameterUtil.getHostNameFromNameNodeURI(hcConnection.getNameNodeURI()));
    map.put(ConnParameterKeys.CONN_PARA_KEY_USERNAME,hcConnection.getUserName());
    map.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_DISTRIBUTION,hcConnection.getDistribution());
    map.put(ConnParameterKeys.CONN_PARA_KEY_HIVE_VERSION,hcConnection.getDfVersion());
    map.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_DISTRIBUTION,hcConnection.getDistribution());
    map.put(ConnParameterKeys.CONN_PARA_KEY_HBASE_VERSION,hcConnection.getDfVersion());
    if (hcConnection.isEnableKerberos()) {
      map.put(ConnParameterKeys.CONN_PARA_KEY_USEKEYTAB,String.valueOf(hcConnection.isUseKeytab()));
      if (hcConnection.isUseKeytab()) {
        map.put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB_PRINCIPAL,hcConnection.getKeytabPrincipal());
        map.put(ConnParameterKeys.CONN_PARA_KEY_KEYTAB,hcConnection.getKeytab());
      }
    }
  }
  return map;
}