Program: 106249
Project: 106249
Buggy source:
@Override public Answer createVolume(CreateObjectCommand cmd){
  VolumeObjectTO volume=(VolumeObjectTO)cmd.getData();
  PrimaryDataStoreTO primaryStore=(PrimaryDataStoreTO)volume.getDataStore();
  try {
    VmwareContext context=this.hostService.getServiceContext(null);
    VmwareHypervisorHost hyperHost=this.hostService.getHyperHost(context,null);
    DatacenterMO dcMo=new DatacenterMO(context,hyperHost.getHyperHostDatacenter());
    ManagedObjectReference morDatastore=HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,primaryStore.getUuid());
    if (morDatastore == null)     throw new Exception("String_Node_Str");
    DatastoreMO dsMo=new DatastoreMO(context,morDatastore);
    VirtualMachineMO vmMo=null;
    String volumeUuid=UUID.randomUUID().toString().replace("String_Node_Str","String_Node_Str");
    String volumeDatastorePath=String.format("String_Node_Str",dsMo.getName(),volumeUuid);
    String dummyVmName=this.hostService.getWorkerName(context,cmd,0);
    try {
      vmMo=prepareVolumeHostDummyVm(hyperHost,dsMo,dummyVmName);
      if (vmMo == null) {
        throw new Exception("String_Node_Str");
      }
synchronized (this) {
        VmwareHelper.deleteVolumeVmdkFiles(dsMo,volumeUuid.toString(),dcMo);
        vmMo.createDisk(volumeDatastorePath,(int)(volume.getSize() / (1024L * 1024L)),morDatastore,vmMo.getScsiDeviceControllerKey());
        vmMo.detachDisk(volumeDatastorePath,false);
      }
      VolumeObjectTO newVol=new VolumeObjectTO();
      newVol.setPath(volumeUuid);
      return new CreateObjectAnswer(newVol);
    }
  finally {
      s_logger.info("String_Node_Str");
      vmMo.detachAllDisks();
      vmMo.destroy();
    }
  }
 catch (  Throwable e) {
    if (e instanceof RemoteException) {
      s_logger.warn("String_Node_Str");
      this.hostService.invalidateServiceContext(null);
    }
    String msg="String_Node_Str" + VmwareHelper.getExceptionMessage(e);
    s_logger.error(msg,e);
    return new CreateObjectAnswer(e.toString());
  }
}

Fixed version (ground truth):
@Override public Answer createVolume(CreateObjectCommand cmd){
  VolumeObjectTO volume=(VolumeObjectTO)cmd.getData();
  PrimaryDataStoreTO primaryStore=(PrimaryDataStoreTO)volume.getDataStore();
  try {
    VmwareContext context=this.hostService.getServiceContext(null);
    VmwareHypervisorHost hyperHost=this.hostService.getHyperHost(context,null);
    DatacenterMO dcMo=new DatacenterMO(context,hyperHost.getHyperHostDatacenter());
    ManagedObjectReference morDatastore=HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,primaryStore.getUuid());
    if (morDatastore == null)     throw new Exception("String_Node_Str");
    DatastoreMO dsMo=new DatastoreMO(context,morDatastore);
    VirtualMachineMO vmMo=null;
    String volumeUuid=UUID.randomUUID().toString().replace("String_Node_Str","String_Node_Str");
    String volumeDatastorePath=String.format("String_Node_Str",dsMo.getName(),volumeUuid);
    String dummyVmName=this.hostService.getWorkerName(context,cmd,0);
    try {
      vmMo=prepareVolumeHostDummyVm(hyperHost,dsMo,dummyVmName);
      if (vmMo == null) {
        throw new Exception("String_Node_Str");
      }
synchronized (this) {
        VmwareHelper.deleteVolumeVmdkFiles(dsMo,volumeUuid.toString(),dcMo);
        vmMo.createDisk(volumeDatastorePath,(int)(volume.getSize() / (1024L * 1024L)),morDatastore,vmMo.getScsiDeviceControllerKey());
        vmMo.detachDisk(volumeDatastorePath,false);
      }
      VolumeObjectTO newVol=new VolumeObjectTO();
      newVol.setPath(volumeUuid);
      newVol.setSize(volume.getSize() / (1024L * 1024L));
      return new CreateObjectAnswer(newVol);
    }
  finally {
      s_logger.info("String_Node_Str");
      vmMo.detachAllDisks();
      vmMo.destroy();
    }
  }
 catch (  Throwable e) {
    if (e instanceof RemoteException) {
      s_logger.warn("String_Node_Str");
      this.hostService.invalidateServiceContext(null);
    }
    String msg="String_Node_Str" + VmwareHelper.getExceptionMessage(e);
    s_logger.error(msg,e);
    return new CreateObjectAnswer(e.toString());
  }
}