Program: 48614
Project: 48614
Buggy source:
@SuppressWarnings("String_Node_Str") private NodeGroupCreate convertNodeGroups(ClusterEntity clusterEntity,NodeGroupEntity ngEntity,String clusterName){
  Gson gson=new Gson();
  List<String> groupRoles=gson.fromJson(ngEntity.getRoles(),List.class);
  String distro=clusterEntity.getDistro();
  NodeGroupCreate group=new NodeGroupCreate();
  group.setName(ngEntity.getName());
  EnumSet<HadoopRole> enumRoles=null;
  if (clusterEntity.getAppManager() == null) {
    enumRoles=getEnumRoles(groupRoles,distro);
    if (enumRoles.isEmpty()) {
      throw ClusterConfigException.NO_HADOOP_ROLE_SPECIFIED(ngEntity.getName());
    }
    GroupType groupType=GroupType.fromHadoopRole(enumRoles);
    AuAssert.check(groupType != null);
    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(ClusterEntity clusterEntity,NodeGroupEntity ngEntity,String clusterName){
  Gson gson=new Gson();
  List<String> groupRoles=gson.fromJson(ngEntity.getRoles(),List.class);
  String distro=clusterEntity.getDistro();
  NodeGroupCreate group=new NodeGroupCreate();
  group.setName(ngEntity.getName());
  EnumSet<HadoopRole> enumRoles=null;
  if (clusterEntity.getAppManager() == null || Constants.IRONFAN.equalsIgnoreCase(clusterEntity.getAppManager())) {
    enumRoles=getEnumRoles(groupRoles,distro);
    if (enumRoles.isEmpty()) {
      throw ClusterConfigException.NO_HADOOP_ROLE_SPECIFIED(ngEntity.getName());
    }
    GroupType groupType=GroupType.fromHadoopRole(enumRoles);
    AuAssert.check(groupType != null);
    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;
}