Program: 48327
Project: 48327
Buggy source:
public NodeGroupRead toNodeGroupRead(boolean ignoreObsoleteNode){
  NodeGroupRead nodeGroupRead=new NodeGroupRead();
  nodeGroupRead.setName(this.name);
  nodeGroupRead.setCpuNum(this.cpuNum);
  nodeGroupRead.setMemCapacityMB(this.memorySize);
  nodeGroupRead.setSwapRatio(this.swapRatio);
  nodeGroupRead.setInstanceNum(this.getRealInstanceNum(ignoreObsoleteNode));
  Gson gson=new Gson();
  @SuppressWarnings("String_Node_Str") List<String> groupRoles=gson.fromJson(roles,List.class);
  nodeGroupRead.setRoles(groupRoles);
  StorageRead storage=new StorageRead();
  storage.setType(this.storageType.toString());
  storage.setSizeGB(this.storageSize);
  storage.setDiskNum(this.diskNum);
  storage.setShareDatastore(this.shareDatastore);
  List<String> datastoreNameList=getVcDatastoreNameList();
  if (datastoreNameList != null && !datastoreNameList.isEmpty())   storage.setDsNames(datastoreNameList);
  if (getSdDatastoreNameList() != null && !getSdDatastoreNameList().isEmpty())   storage.setDsNames4System(getSdDatastoreNameList());
  if (getDdDatastoreNameList() != null && !getDdDatastoreNameList().isEmpty())   storage.setDsNames4Data(getDdDatastoreNameList());
  nodeGroupRead.setStorage(storage);
  List<NodeRead> nodeList=new ArrayList<NodeRead>();
  for (  NodeEntity node : this.nodes) {
    if (ignoreObsoleteNode && (node.isObsoleteNode() || node.isDisconnected())) {
      continue;
    }
    nodeList.add(node.toNodeRead(true));
  }
  nodeGroupRead.setInstances(nodeList);
  List<GroupAssociation> associations=new ArrayList<GroupAssociation>();
  for (  NodeGroupAssociation relation : groupAssociations) {
    GroupAssociation association=new GroupAssociation();
    association.setReference(relation.getReferencedGroup());
    association.setType(relation.getAssociationType());
    associations.add(association);
  }
  PlacementPolicy policy=new PlacementPolicy();
  policy.setInstancePerHost(instancePerHost);
  policy.setGroupAssociations(associations);
  policy.setGroupRacks(new Gson().fromJson(groupRacks,GroupRacks.class));
  nodeGroupRead.setPlacementPolicies(policy);
  return nodeGroupRead;
}

Fixed version (ground truth):
public NodeGroupRead toNodeGroupRead(boolean withNodesList,boolean ignoreObsoleteNode){
  NodeGroupRead nodeGroupRead=new NodeGroupRead();
  nodeGroupRead.setName(this.name);
  nodeGroupRead.setCpuNum(this.cpuNum);
  nodeGroupRead.setMemCapacityMB(this.memorySize);
  nodeGroupRead.setSwapRatio(this.swapRatio);
  nodeGroupRead.setInstanceNum(this.getRealInstanceNum(ignoreObsoleteNode));
  Gson gson=new Gson();
  @SuppressWarnings("String_Node_Str") List<String> groupRoles=gson.fromJson(roles,List.class);
  nodeGroupRead.setRoles(groupRoles);
  StorageRead storage=new StorageRead();
  storage.setType(this.storageType.toString());
  storage.setSizeGB(this.storageSize);
  storage.setDiskNum(this.diskNum);
  storage.setShareDatastore(this.shareDatastore);
  List<String> datastoreNameList=getVcDatastoreNameList();
  if (datastoreNameList != null && !datastoreNameList.isEmpty())   storage.setDsNames(datastoreNameList);
  if (getSdDatastoreNameList() != null && !getSdDatastoreNameList().isEmpty())   storage.setDsNames4System(getSdDatastoreNameList());
  if (getDdDatastoreNameList() != null && !getDdDatastoreNameList().isEmpty())   storage.setDsNames4Data(getDdDatastoreNameList());
  nodeGroupRead.setStorage(storage);
  if (withNodesList) {
    List<NodeRead> nodeList=new ArrayList<NodeRead>();
    for (    NodeEntity node : this.nodes) {
      if (ignoreObsoleteNode && (node.isObsoleteNode() || node.isDisconnected())) {
        continue;
      }
      nodeList.add(node.toNodeRead(true));
    }
    nodeGroupRead.setInstances(nodeList);
  }
  List<GroupAssociation> associations=new ArrayList<GroupAssociation>();
  for (  NodeGroupAssociation relation : groupAssociations) {
    GroupAssociation association=new GroupAssociation();
    association.setReference(relation.getReferencedGroup());
    association.setType(relation.getAssociationType());
    associations.add(association);
  }
  PlacementPolicy policy=new PlacementPolicy();
  policy.setInstancePerHost(instancePerHost);
  policy.setGroupAssociations(associations);
  policy.setGroupRacks(new Gson().fromJson(groupRacks,GroupRacks.class));
  nodeGroupRead.setPlacementPolicies(policy);
  return nodeGroupRead;
}