Program: 48916
Project: 48916
Buggy source:
@Override public Void call() throws Exception {
  final VcVirtualMachine vcVm=VcCache.getIgnoreMissing(vmId);
  if (vcVm == null) {
    logger.info("String_Node_Str" + vmId + "String_Node_Str");
    return null;
  }
  if (vcVm.isPoweredOn()) {
    logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
    return null;
  }
  logger.info("String_Node_Str" + vmId + "String_Node_Str"+ cpuNumber+ "String_Node_Str"+ memory);
  return VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      ConfigSpecImpl newConfigSpec=new ConfigSpecImpl();
      if (cpuNumber > 0) {
        newConfigSpec.setNumCPUs(cpuNumber);
      }
      if (memory > 0) {
        VmConfigUtil.setMemoryAndBalloon(newConfigSpec,memory);
        if (targetDs != null) {
          VirtualDisk vmSwapDisk=VcVmUtil.findVirtualDisk(vmId,swapDisk.getExternalAddress());
          logger.info("String_Node_Str" + swapDisk.getDatastoreName());
          logger.info("String_Node_Str" + targetDs.getName());
          if (swapDisk.getDatastoreMoId().equals(targetDs.getId())) {
            VirtualDeviceSpec devSpec=new VirtualDeviceSpecImpl();
            devSpec.setOperation(VirtualDeviceSpec.Operation.edit);
            vmSwapDisk.setCapacityInKB(newSwapSizeInMB * 1024);
            devSpec.setDevice(vmSwapDisk);
            VirtualDeviceSpec[] changes={devSpec};
            newConfigSpec.setDeviceChange(changes);
            logger.info("String_Node_Str");
          }
 else {
            vcVm.detachVirtualDisk(new DeviceId(swapDisk.getExternalAddress()),true);
            AllocationType allocType=swapDisk.getAllocType() == null ? null : AllocationType.valueOf(swapDisk.getAllocType());
            DiskCreateSpec[] addDisks={new DiskCreateSpec(new DeviceId(swapDisk.getExternalAddress()),targetDs,swapDisk.getName(),DiskMode.independent_persistent,DiskSize.sizeFromMB(newSwapSizeInMB),allocType)};
            vcVm.changeDisks(null,addDisks);
          }
        }
      }
      vcVm.reconfigure(newConfigSpec);
      return null;
    }
    protected boolean isTaskSession(){
      return true;
    }
  }
);
}

Fixed version (ground truth):
@Override public Void call() throws Exception {
  final VcVirtualMachine vcVm=VcCache.getIgnoreMissing(vmId);
  if (vcVm == null) {
    logger.info("String_Node_Str" + vmId + "String_Node_Str");
    return null;
  }
  if (vcVm.isPoweredOn()) {
    logger.info("String_Node_Str" + vcVm.getName() + "String_Node_Str");
    return null;
  }
  logger.info("String_Node_Str" + vmId + "String_Node_Str"+ cpuNumber+ "String_Node_Str"+ memory);
  return VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      ConfigSpecImpl newConfigSpec=new ConfigSpecImpl();
      if (cpuNumber > 0) {
        newConfigSpec.setNumCPUs(cpuNumber);
      }
      if (memory > 0) {
        VmConfigUtil.setMemoryAndBalloon(newConfigSpec,memory);
        if (targetDs != null) {
          logger.info("String_Node_Str" + swapDisk.getDatastoreName());
          logger.info("String_Node_Str" + targetDs.getName());
          vcVm.detachVirtualDisk(new DeviceId(swapDisk.getExternalAddress()),true);
          AllocationType allocType=swapDisk.getAllocType() == null ? null : AllocationType.valueOf(swapDisk.getAllocType());
          DiskCreateSpec[] addDisks={new DiskCreateSpec(new DeviceId(swapDisk.getExternalAddress()),targetDs,swapDisk.getName(),DiskMode.independent_persistent,DiskSize.sizeFromMB(newSwapSizeInMB),allocType)};
          vcVm.changeDisks(null,addDisks);
        }
      }
      vcVm.reconfigure(newConfigSpec);
      return null;
    }
    protected boolean isTaskSession(){
      return true;
    }
  }
);
}