Program: 48373
Project: 48373
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);
  NodeGroupCreate group=new NodeGroupCreate();
  group.setName(ngEntity.getName());
  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);
  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);
  NodeGroupCreate group=new NodeGroupCreate();
  group.setName(ngEntity.getName());
  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);
  group.setHaFlag(ngEntity.getHaFlag());
  group.setLatencySensitivity(ngEntity.getLatencySensitivity());
  group.setReservedCpu_ratio(ngEntity.getReservedCpu_ratio());
  group.setReservedMem_ratio(ngEntity.getReservedMem_ratio());
  if (ngEntity.getHadoopConfig() != null) {
    Map<String,Object> hadoopConfig=(new Gson()).fromJson(ngEntity.getHadoopConfig(),Map.class);
    group.setConfiguration(hadoopConfig);
  }
  group.setVmFolderPath(ngEntity.getVmFolderPath());
  return group;
}