Program: 48827
Project: 48827
Buggy source:
@Override public BaseNode getBaseNode(ClusterCreate cluster,NodeGroupCreate nodeGroup,int index){
  String vmName=PlacementUtil.getVmName(cluster.getName(),nodeGroup.getName(),index);
  BaseNode node=new BaseNode(vmName,nodeGroup,cluster);
  List<DiskSpec> disks=new ArrayList<DiskSpec>();
  DiskSpec systemDisk=new DiskSpec(templateNode.getDisks().get(0));
  systemDisk.setSize(systemDisk.getSize() + (nodeGroup.getMemCapacityMB() + 1023) / 1024);
  systemDisk.setDiskType(DiskType.SYSTEM_DISK);
  systemDisk.setSeparable(false);
  disks.add(systemDisk);
  AllocationType diskAllocType=null;
  if (nodeGroup.getStorage().getAllocType() != null) {
    diskAllocType=AllocationType.valueOf(nodeGroup.getStorage().getAllocType());
  }
 else {
    diskAllocType=AllocationType.THICK;
  }
  int swapDisk=(((int)Math.ceil(nodeGroup.getMemCapacityMB() * nodeGroup.getSwapRatio()) + 1023) / 1024);
  disks.add(new DiskSpec(DiskType.SWAP_DISK.getDiskName(),swapDisk,node.getVmName(),false,DiskType.SWAP_DISK,DiskScsiControllerType.LSI_CONTROLLER,null,diskAllocType.toString(),null,null,null));
  if (!DatastoreType.TEMPFS.name().equalsIgnoreCase(nodeGroup.getStorage().getType())) {
    disks.add(new DiskSpec(DiskType.DATA_DISK.getDiskName(),nodeGroup.getStorage().getSizeGB(),node.getVmName(),true,DiskType.DATA_DISK,nodeGroup.getStorage().getControllerType(),nodeGroup.getStorage().getSplitPolicy(),diskAllocType.toString(),null,null,null));
  }
  node.setDisks(disks);
  node.setVmFolder(nodeGroup.getVmFolderPath());
  NetworkSchema netSchema=new NetworkSchema();
  ArrayList<Network> networks=new ArrayList<Network>();
  netSchema.networks=networks;
  for (  NetworkAdd networkAdd : cluster.getNetworkings()) {
    Network network=new Network();
    network.vcNetwork=networkAdd.getPortGroup();
    networks.add(network);
  }
  node.getVmSchema().networkSchema=netSchema;
  ResourceSchema resourceSchema=new ResourceSchema();
  resourceSchema.numCPUs=node.getCpu();
  resourceSchema.cpuReservationMHz=0;
  resourceSchema.memSize=node.getMem();
  resourceSchema.memReservationSize=0;
  resourceSchema.name="String_Node_Str";
  resourceSchema.priority=Priority.Normal;
  node.getVmSchema().resourceSchema=resourceSchema;
  return node;
}

Fixed version (ground truth):
@Override public BaseNode getBaseNode(ClusterCreate cluster,NodeGroupCreate nodeGroup,int index){
  String vmName=PlacementUtil.getVmName(cluster.getName(),nodeGroup.getName(),index);
  BaseNode node=new BaseNode(vmName,nodeGroup,cluster);
  List<DiskSpec> disks=new ArrayList<DiskSpec>();
  DiskSpec systemDisk=new DiskSpec(templateNode.getDisks().get(0));
  Integer memCapa=nodeGroup.getMemCapacityMB();
  memCapa=(memCapa == null) ? 0 : memCapa;
  systemDisk.setSize(systemDisk.getSize() + (memCapa + 1023) / 1024);
  systemDisk.setDiskType(DiskType.SYSTEM_DISK);
  systemDisk.setSeparable(false);
  disks.add(systemDisk);
  AllocationType diskAllocType=null;
  if (nodeGroup.getStorage().getAllocType() != null) {
    diskAllocType=AllocationType.valueOf(nodeGroup.getStorage().getAllocType());
  }
 else {
    diskAllocType=AllocationType.THICK;
  }
  int swapDisk=(((int)Math.ceil(nodeGroup.getMemCapacityMB() * nodeGroup.getSwapRatio()) + 1023) / 1024);
  disks.add(new DiskSpec(DiskType.SWAP_DISK.getDiskName(),swapDisk,node.getVmName(),false,DiskType.SWAP_DISK,DiskScsiControllerType.LSI_CONTROLLER,null,diskAllocType.toString(),null,null,null));
  if (!DatastoreType.TEMPFS.name().equalsIgnoreCase(nodeGroup.getStorage().getType())) {
    disks.add(new DiskSpec(DiskType.DATA_DISK.getDiskName(),nodeGroup.getStorage().getSizeGB(),node.getVmName(),true,DiskType.DATA_DISK,nodeGroup.getStorage().getControllerType(),nodeGroup.getStorage().getSplitPolicy(),diskAllocType.toString(),null,null,null));
  }
  node.setDisks(disks);
  node.setVmFolder(nodeGroup.getVmFolderPath());
  NetworkSchema netSchema=new NetworkSchema();
  ArrayList<Network> networks=new ArrayList<Network>();
  netSchema.networks=networks;
  for (  NetworkAdd networkAdd : cluster.getNetworkings()) {
    Network network=new Network();
    network.vcNetwork=networkAdd.getPortGroup();
    networks.add(network);
  }
  node.getVmSchema().networkSchema=netSchema;
  ResourceSchema resourceSchema=new ResourceSchema();
  resourceSchema.numCPUs=node.getCpu();
  resourceSchema.cpuReservationMHz=0;
  resourceSchema.memSize=node.getMem();
  resourceSchema.memReservationSize=0;
  resourceSchema.name="String_Node_Str";
  resourceSchema.priority=Priority.Normal;
  node.getVmSchema().resourceSchema=resourceSchema;
  return node;
}