Program: 48954
Project: 48954
Buggy source:
@SuppressWarnings("String_Node_Str") public ClusterRead toClusterRead(String clusterName){
  ClusterEntity cluster=findByName(clusterName);
  ClusterStatus clusterStatus=cluster.getStatus();
  ClusterRead clusterRead=new ClusterRead();
  clusterRead.setInstanceNum(cluster.getRealInstanceNum());
  clusterRead.setName(cluster.getName());
  clusterRead.setStatus(clusterStatus);
  clusterRead.setDistro(cluster.getDistro());
  clusterRead.setDistroVendor(cluster.getDistroVendor());
  clusterRead.setTopologyPolicy(cluster.getTopologyPolicy());
  clusterRead.setAutomationEnable(cluster.getAutomationEnable());
  clusterRead.setVhmMinNum(cluster.getVhmMinNum());
  clusterRead.setVhmTargetNum(cluster.getVhmTargetNum());
  clusterRead.setIoShares(cluster.getIoShares());
  List<NodeGroupRead> groupList=new ArrayList<NodeGroupRead>();
  for (  NodeGroupEntity group : cluster.getNodeGroups()) {
    groupList.add(group.toNodeGroupRead());
  }
  clusterRead.setNodeGroups(groupList);
  if (cluster.getHadoopConfig() != null) {
    Map conf=(new Gson()).fromJson(cluster.getHadoopConfig(),Map.class);
    Map hadoopConf=(Map)conf.get("String_Node_Str");
    if (hadoopConf != null) {
      Map coreSiteConf=(Map)hadoopConf.get("String_Node_Str");
      if (coreSiteConf != null) {
        String hdfs=(String)coreSiteConf.get("String_Node_Str");
        if (hdfs != null && !hdfs.isEmpty()) {
          clusterRead.setExternalHDFS(hdfs);
        }
      }
    }
  }
  Set<VcResourcePoolEntity> rps=cluster.getUsedRps();
  List<ResourcePoolRead> rpReads=new ArrayList<ResourcePoolRead>(rps.size());
  for (  VcResourcePoolEntity rp : rps) {
    ResourcePoolRead rpRead=rp.toRest();
    rpRead.setNodes(null);
    rpReads.add(rpRead);
  }
  clusterRead.setResourcePools(rpReads);
  if (clusterStatus == ClusterStatus.RUNNING || clusterStatus == ClusterStatus.STOPPED) {
    clusterRead.setDcSeperation(clusterRead.validateSetManualElasticity());
  }
  return clusterRead;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public ClusterRead toClusterRead(String clusterName){
  ClusterEntity cluster=findByName(clusterName);
  ClusterStatus clusterStatus=cluster.getStatus();
  ClusterRead clusterRead=new ClusterRead();
  clusterRead.setInstanceNum(cluster.getRealInstanceNum());
  clusterRead.setName(cluster.getName());
  clusterRead.setStatus(clusterStatus);
  clusterRead.setDistro(cluster.getDistro());
  clusterRead.setDistroVendor(cluster.getDistroVendor());
  clusterRead.setTopologyPolicy(cluster.getTopologyPolicy());
  clusterRead.setAutomationEnable(cluster.getAutomationEnable());
  clusterRead.setVhmMinNum(cluster.getVhmMinNum());
  clusterRead.setVhmTargetNum(cluster.getVhmTargetNum());
  clusterRead.setIoShares(cluster.getIoShares());
  boolean computeOnly=true;
  List<NodeGroupRead> groupList=new ArrayList<NodeGroupRead>();
  for (  NodeGroupEntity group : cluster.getNodeGroups()) {
    groupList.add(group.toNodeGroupRead());
    if (group.getRoles() != null && (group.getRoles().contains(HadoopRole.HADOOP_NAMENODE_ROLE.toString()) || group.getRoles().contains(HadoopRole.MAPR_CLDB_ROLE.toString()))) {
      computeOnly=false;
    }
  }
  clusterRead.setNodeGroups(groupList);
  if (computeOnly && cluster.getHadoopConfig() != null) {
    Map conf=(new Gson()).fromJson(cluster.getHadoopConfig(),Map.class);
    Map hadoopConf=(Map)conf.get("String_Node_Str");
    if (hadoopConf != null) {
      Map coreSiteConf=(Map)hadoopConf.get("String_Node_Str");
      if (coreSiteConf != null) {
        String hdfs=(String)coreSiteConf.get("String_Node_Str");
        if (hdfs != null && !hdfs.isEmpty()) {
          clusterRead.setExternalHDFS(hdfs);
        }
      }
    }
  }
  Set<VcResourcePoolEntity> rps=cluster.getUsedRps();
  List<ResourcePoolRead> rpReads=new ArrayList<ResourcePoolRead>(rps.size());
  for (  VcResourcePoolEntity rp : rps) {
    ResourcePoolRead rpRead=rp.toRest();
    rpRead.setNodes(null);
    rpReads.add(rpRead);
  }
  clusterRead.setResourcePools(rpReads);
  if (clusterStatus == ClusterStatus.RUNNING || clusterStatus == ClusterStatus.STOPPED) {
    clusterRead.setDcSeperation(clusterRead.validateSetManualElasticity());
  }
  return clusterRead;
}