Program: 49011
Project: 49011
Buggy source:
public NodeGroupRead toNodeGroupRead(){
  NodeGroupRead nodeGroupRead=new NodeGroupRead();
  nodeGroupRead.setName(this.name);
  nodeGroupRead.setCpuNum(this.cpuNum);
  nodeGroupRead.setMemCapacityMB(this.memorySize);
  nodeGroupRead.setSwapRatio(this.swapRatio);
  nodeGroupRead.setInstanceNum(this.getRealInstanceNum());
  nodeGroupRead.setIoShares(this.ioShares);
  Gson gson=new Gson();
  @SuppressWarnings("String_Node_Str") List<String> groupRoles=gson.fromJson(roles,List.class);
  Collections.sort(groupRoles,new Comparator<String>(){
    @Override 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;
      }
    }
  }
);
  nodeGroupRead.setRoles(groupRoles);
  StorageRead storage=new StorageRead();
  storage.setType(this.storageType.toString());
  storage.setSizeGB(this.storageSize);
  storage.setDiskBisect(this.diskBisect);
  storage.setDsNames(getVcDatastoreNameList());
  nodeGroupRead.setStorage(storage);
  List<NodeRead> nodeList=new ArrayList<NodeRead>();
  for (  NodeEntity node : this.nodes) {
    nodeList.add(node.toNodeRead());
  }
  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(){
  NodeGroupRead nodeGroupRead=new NodeGroupRead();
  nodeGroupRead.setName(this.name);
  nodeGroupRead.setCpuNum(this.cpuNum);
  nodeGroupRead.setMemCapacityMB(this.memorySize);
  nodeGroupRead.setSwapRatio(this.swapRatio);
  nodeGroupRead.setInstanceNum(this.getRealInstanceNum());
  nodeGroupRead.setIoShares(this.ioShares);
  Gson gson=new Gson();
  @SuppressWarnings("String_Node_Str") List<String> groupRoles=gson.fromJson(roles,List.class);
  Collections.sort(groupRoles,new Comparator<String>(){
    @Override 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;
      }
    }
  }
);
  nodeGroupRead.setRoles(groupRoles);
  StorageRead storage=new StorageRead();
  storage.setType(this.storageType.toString());
  storage.setSizeGB(this.storageSize);
  storage.setDsNames(getVcDatastoreNameList());
  nodeGroupRead.setStorage(storage);
  List<NodeRead> nodeList=new ArrayList<NodeRead>();
  for (  NodeEntity node : this.nodes) {
    nodeList.add(node.toNodeRead());
  }
  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;
}