Program: 48727
Project: 48727
Buggy source:
@SuppressWarnings("String_Node_Str") private NodeGroupCreate convertNodeGroups(String distro,NodeGroupEntity ngEntity,String clusterName){
  Gson gson=new Gson();
  List<String> groupRoles=gson.fromJson(ngEntity.getRoles(),List.class);
  Collections.sort(groupRoles,new Comparator<String>(){
    public int compare(    String str1,    String str2){
      if (HadoopRole.fromString(str1).shouldRunAfterHDFS()) {
        return 1;
      }
 else       if (HadoopRole.fromString(str2).shouldRunAfterHDFS()) {
        return -1;
      }
 else {
        return 0;
      }
    }
  }
);
  EnumSet<HadoopRole> enumRoles=getEnumRoles(groupRoles,distro);
  if (enumRoles.isEmpty()) {
    throw ClusterConfigException.NO_HADOOP_ROLE_SPECIFIED(ngEntity.getName());
  }
  GroupType groupType=GroupType.fromHadoopRole(enumRoles);
  AuAssert.check(groupType != null);
  NodeGroupCreate group=new NodeGroupCreate();
  group.setName(ngEntity.getName());
  group.setGroupType(groupType);
  group.setRoles(groupRoles);
  int cpu=ngEntity.getCpuNum();
  if (cpu > 0) {
    group.setCpuNum(cpu);
  }
  int memory=ngEntity.getMemorySize();
  if (memory > 0) {
    group.setMemCapacityMB(memory);
  }
  Float swapRatio=ngEntity.getSwapRatio();
  if (swapRatio != null && swapRatio > 0) {
    group.setSwapRatio(swapRatio);
  }
  if (ngEntity.getNodeType() != null) {
    group.setInstanceType(ngEntity.getNodeType());
  }
  group.setInstanceNum(ngEntity.getDefineInstanceNum());
  Integer instancePerHost=ngEntity.getInstancePerHost();
  Set<NodeGroupAssociation> associonEntities=ngEntity.getGroupAssociations();
  String ngRacks=ngEntity.getGroupRacks();
  if (instancePerHost == null && (associonEntities == null || associonEntities.isEmpty()) && ngRacks == null) {
    group.setPlacementPolicies(null);
  }
 else {
    PlacementPolicy policies=new PlacementPolicy();
    policies.setInstancePerHost(instancePerHost);
    if (ngRacks != null) {
      policies.setGroupRacks((GroupRacks)new Gson().fromJson(ngRacks,GroupRacks.class));
    }
    if (associonEntities != null) {
      List<GroupAssociation> associons=new ArrayList<GroupAssociation>(associonEntities.size());
      for (      NodeGroupAssociation ae : associonEntities) {
        GroupAssociation a=new GroupAssociation();
        a.setReference(ae.getReferencedGroup());
        a.setType(ae.getAssociationType());
        associons.add(a);
      }
      policies.setGroupAssociations(associons);
    }
    group.setPlacementPolicies(policies);
  }
  String rps=ngEntity.getVcRpNames();
  if (rps != null && rps.length() > 0) {
    logger.debug("String_Node_Str" + ngEntity.getName());
    String[] rpNames=gson.fromJson(rps,String[].class);
    List<VcCluster> vcClusters=rpMgr.getVcResourcePoolByNameList(rpNames);
    group.setVcClusters(vcClusters);
    group.setRpNames(Arrays.asList(rpNames));
  }
  expandGroupStorage(ngEntity,group,enumRoles);
  group.setHaFlag(ngEntity.getHaFlag());
  if (ngEntity.getHadoopConfig() != null) {
    Map<String,Object> hadoopConfig=(new Gson()).fromJson(ngEntity.getHadoopConfig(),Map.class);
    group.setConfiguration(hadoopConfig);
  }
  group.setVmFolderPath(ngEntity.getVmFolderPath());
  return group;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private NodeGroupCreate convertNodeGroups(String distro,NodeGroupEntity ngEntity,String clusterName){
  Gson gson=new Gson();
  List<String> groupRoles=gson.fromJson(ngEntity.getRoles(),List.class);
  EnumSet<HadoopRole> enumRoles=getEnumRoles(groupRoles,distro);
  if (enumRoles.isEmpty()) {
    throw ClusterConfigException.NO_HADOOP_ROLE_SPECIFIED(ngEntity.getName());
  }
  GroupType groupType=GroupType.fromHadoopRole(enumRoles);
  AuAssert.check(groupType != null);
  NodeGroupCreate group=new NodeGroupCreate();
  group.setName(ngEntity.getName());
  group.setGroupType(groupType);
  group.setRoles(groupRoles);
  int cpu=ngEntity.getCpuNum();
  if (cpu > 0) {
    group.setCpuNum(cpu);
  }
  int memory=ngEntity.getMemorySize();
  if (memory > 0) {
    group.setMemCapacityMB(memory);
  }
  Float swapRatio=ngEntity.getSwapRatio();
  if (swapRatio != null && swapRatio > 0) {
    group.setSwapRatio(swapRatio);
  }
  if (ngEntity.getNodeType() != null) {
    group.setInstanceType(ngEntity.getNodeType());
  }
  group.setInstanceNum(ngEntity.getDefineInstanceNum());
  Integer instancePerHost=ngEntity.getInstancePerHost();
  Set<NodeGroupAssociation> associonEntities=ngEntity.getGroupAssociations();
  String ngRacks=ngEntity.getGroupRacks();
  if (instancePerHost == null && (associonEntities == null || associonEntities.isEmpty()) && ngRacks == null) {
    group.setPlacementPolicies(null);
  }
 else {
    PlacementPolicy policies=new PlacementPolicy();
    policies.setInstancePerHost(instancePerHost);
    if (ngRacks != null) {
      policies.setGroupRacks((GroupRacks)new Gson().fromJson(ngRacks,GroupRacks.class));
    }
    if (associonEntities != null) {
      List<GroupAssociation> associons=new ArrayList<GroupAssociation>(associonEntities.size());
      for (      NodeGroupAssociation ae : associonEntities) {
        GroupAssociation a=new GroupAssociation();
        a.setReference(ae.getReferencedGroup());
        a.setType(ae.getAssociationType());
        associons.add(a);
      }
      policies.setGroupAssociations(associons);
    }
    group.setPlacementPolicies(policies);
  }
  String rps=ngEntity.getVcRpNames();
  if (rps != null && rps.length() > 0) {
    logger.debug("String_Node_Str" + ngEntity.getName());
    String[] rpNames=gson.fromJson(rps,String[].class);
    List<VcCluster> vcClusters=rpMgr.getVcResourcePoolByNameList(rpNames);
    group.setVcClusters(vcClusters);
    group.setRpNames(Arrays.asList(rpNames));
  }
  expandGroupStorage(ngEntity,group,enumRoles);
  group.setHaFlag(ngEntity.getHaFlag());
  if (ngEntity.getHadoopConfig() != null) {
    Map<String,Object> hadoopConfig=(new Gson()).fromJson(ngEntity.getHadoopConfig(),Map.class);
    group.setConfiguration(hadoopConfig);
  }
  group.setVmFolderPath(ngEntity.getVmFolderPath());
  return group;
}