Program: 107174
Project: 107174
Buggy source:
@Override @ActionEvent(eventType=EventTypes.EVENT_VOLUME_DELETE,eventDescription="String_Node_Str") public boolean deleteVolume(DeleteVolumeCmd cmd) throws ConcurrentOperationException {
  Account account=UserContext.current().getCaller();
  Long volumeId=cmd.getId();
  boolean isAdmin;
  if (account == null) {
    isAdmin=true;
  }
 else {
    isAdmin=isAdmin(account.getType());
  }
  VolumeVO volume=_volsDao.findById(volumeId);
  if (volume == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId);
  }
  if (!isAdmin) {
    if (account.getId() != volume.getAccountId()) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str"+ account.getAccountName());
    }
  }
 else   if ((account != null) && !_domainDao.isChildDomain(account.getDomainId(),volume.getDomainId())) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str");
  }
  if (!isAdmin) {
    if (account.getId() != volume.getAccountId()) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str"+ account.getAccountName());
    }
  }
 else   if ((account != null) && !_domainDao.isChildDomain(account.getDomainId(),volume.getDomainId())) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str");
  }
  if (volume.getInstanceId() != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (volume.getState() != Volume.State.Destroy) {
    destroyVolume(volume);
  }
  try {
    expungeVolume(volume);
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str",e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override @ActionEvent(eventType=EventTypes.EVENT_VOLUME_DELETE,eventDescription="String_Node_Str") public boolean deleteVolume(DeleteVolumeCmd cmd) throws ConcurrentOperationException {
  Account account=UserContext.current().getCaller();
  Long volumeId=cmd.getId();
  boolean isAdmin;
  if (account == null) {
    isAdmin=true;
  }
 else {
    isAdmin=isAdmin(account.getType());
  }
  VolumeVO volume=_volsDao.findById(volumeId);
  if (volume == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId);
  }
  if (!isAdmin) {
    if (account.getId() != volume.getAccountId()) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str"+ account.getAccountName());
    }
  }
 else   if ((account != null) && !_domainDao.isChildDomain(account.getDomainId(),volume.getDomainId())) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str");
  }
  if (!isAdmin) {
    if (account.getId() != volume.getAccountId()) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str"+ account.getAccountName());
    }
  }
 else   if ((account != null) && !_domainDao.isChildDomain(account.getDomainId(),volume.getDomainId())) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + volumeId + "String_Node_Str");
  }
  if (volume.getInstanceId() != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  if (volume.getState() != Volume.State.Destroy) {
    destroyVolume(volume);
    UsageEventVO usageEvent=new UsageEventVO(EventTypes.EVENT_VOLUME_DELETE,volume.getAccountId(),volume.getDataCenterId(),volumeId,volume.getName(),null,null,null);
    _usageEventDao.persist(usageEvent);
  }
  try {
    expungeVolume(volume);
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str",e);
    return false;
  }
  return true;
}