Program: 107306
Project: 107306
Buggy source:
@Override @DB public SnapshotVO createSnapshotImpl(Long volumeId,Long policyId,Long snapshotId,Long startEventId) throws ResourceAllocationException {
  VolumeVO volume=_volsDao.acquireInLockTable(volumeId,10);
  if (volume == null) {
    volume=_volsDao.findById(volumeId);
    if (volume == null) {
      throw new CloudRuntimeException("String_Node_Str" + volumeId + "String_Node_Str");
    }
 else {
      throw new CloudRuntimeException("String_Node_Str" + volumeId + "String_Node_Str");
    }
  }
  if (_volsDao.getHypervisorType(volume.getId()).equals(HypervisorType.KVM)) {
    StoragePoolVO storagePool=_storagePoolDao.findById(volume.getPoolId());
    ClusterVO cluster=_clusterDao.findById(storagePool.getClusterId());
    List<HostVO> hosts=_hostDao.listByCluster(cluster.getId());
    if (hosts != null && !hosts.isEmpty()) {
      HostVO host=hosts.get(0);
      _hostDao.loadDetails(host);
      String hostOS=host.getDetail("String_Node_Str");
      String hostOSVersion=host.getDetail("String_Node_Str");
      if (!(hostOS != null && hostOS.equalsIgnoreCase("String_Node_Str") && hostOSVersion != null && Integer.parseInt(hostOSVersion) >= 13)) {
        throw new CloudRuntimeException("String_Node_Str" + hostOS + "String_Node_Str"+ hostOSVersion+ "String_Node_Str");
      }
    }
  }
  SnapshotVO snapshot=null;
  boolean backedUp=false;
  try {
    snapshot=createSnapshotOnPrimary(volume,policyId,snapshotId);
    if (snapshot != null && snapshot.getStatus() == Snapshot.Status.CreatedOnPrimary) {
      snapshotId=snapshot.getId();
      backedUp=backupSnapshotToSecondaryStorage(snapshot,startEventId);
      if (!backedUp) {
        throw new CloudRuntimeException("String_Node_Str" + snapshotId + "String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    throw new CloudRuntimeException("String_Node_Str" + e.toString());
  }
 finally {
    postCreateSnapshot(volumeId,snapshotId,policyId,backedUp);
    _volsDao.releaseFromLockTable(volumeId);
  }
  return snapshot;
}

Fixed version (ground truth):
@Override @DB public SnapshotVO createSnapshotImpl(Long volumeId,Long policyId,Long snapshotId,Long startEventId) throws ResourceAllocationException {
  VolumeVO v=_volsDao.findById(volumeId);
  if (v != null && _volsDao.getHypervisorType(v.getId()).equals(HypervisorType.KVM)) {
    UserVmVO uservm=_vmDao.findById(v.getInstanceId());
    if (uservm != null) {
      UserVmVO vm=_vmDao.acquireInLockTable(uservm.getId(),10);
      if (vm == null) {
        throw new CloudRuntimeException("String_Node_Str" + volumeId + "String_Node_Str");
      }
    }
  }
  VolumeVO volume=_volsDao.acquireInLockTable(volumeId,10);
  if (volume == null) {
    volume=_volsDao.findById(volumeId);
    if (volume == null) {
      throw new CloudRuntimeException("String_Node_Str" + volumeId + "String_Node_Str");
    }
 else {
      throw new CloudRuntimeException("String_Node_Str" + volumeId + "String_Node_Str");
    }
  }
  if (_volsDao.getHypervisorType(volume.getId()).equals(HypervisorType.KVM)) {
    StoragePoolVO storagePool=_storagePoolDao.findById(volume.getPoolId());
    ClusterVO cluster=_clusterDao.findById(storagePool.getClusterId());
    List<HostVO> hosts=_hostDao.listByCluster(cluster.getId());
    if (hosts != null && !hosts.isEmpty()) {
      HostVO host=hosts.get(0);
      _hostDao.loadDetails(host);
      String hostOS=host.getDetail("String_Node_Str");
      String hostOSVersion=host.getDetail("String_Node_Str");
      if (!(hostOS != null && hostOS.equalsIgnoreCase("String_Node_Str") && hostOSVersion != null && Integer.parseInt(hostOSVersion) >= 13)) {
        throw new CloudRuntimeException("String_Node_Str" + hostOS + "String_Node_Str"+ hostOSVersion+ "String_Node_Str");
      }
    }
  }
  SnapshotVO snapshot=null;
  boolean backedUp=false;
  try {
    snapshot=createSnapshotOnPrimary(volume,policyId,snapshotId);
    if (snapshot != null && snapshot.getStatus() == Snapshot.Status.CreatedOnPrimary) {
      snapshotId=snapshot.getId();
      backedUp=backupSnapshotToSecondaryStorage(snapshot,startEventId);
      if (!backedUp) {
        throw new CloudRuntimeException("String_Node_Str" + snapshotId + "String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    throw new CloudRuntimeException("String_Node_Str" + e.toString());
  }
 finally {
    postCreateSnapshot(volumeId,snapshotId,policyId,backedUp);
    _volsDao.releaseFromLockTable(volumeId);
  }
  return snapshot;
}