Program: 14138
Project: 14138
Buggy source:
public CreateVolumeResponseType CreateVolume(final CreateVolumeType request) throws EucalyptusCloudException, AuthException {
  Context ctx=Contexts.lookup();
  Long volSize=request.getSize() != null ? Long.parseLong(request.getSize()) : null;
  final String snapId=normalizeOptionalSnapshotIdentifier(request.getSnapshotId());
  Integer snapSize=0;
  String partition=request.getAvailabilityZone();
  if ((request.getSnapshotId() == null && request.getSize() == null)) {
    throw new EucalyptusCloudException("String_Node_Str");
  }
  if (snapId != null) {
    try {
      Snapshot snap=Transactions.find(Snapshot.named(null,normalizeOptionalSnapshotIdentifier(snapId)));
      snapSize=snap.getVolumeSize();
      if (!Predicates.and(Snapshots.FilterPermissions.INSTANCE,RestrictedTypes.filterPrivilegedWithoutOwner()).apply(snap)) {
        throw new EucalyptusCloudException("String_Node_Str" + snapId + "String_Node_Str"+ ctx.getUser().getName());
      }
      if (volSize != null && snap != null && snap.getVolumeSize() != null && volSize < snap.getVolumeSize()) {
        throw new EucalyptusCloudException("String_Node_Str");
      }
    }
 catch (    ExecutionException ex) {
      throw new EucalyptusCloudException("String_Node_Str" + snapId);
    }
  }
  final Integer sizeFromRequest=request.getSize() != null ? new Integer(request.getSize()) : null;
  if (sizeFromRequest != null && sizeFromRequest <= 0) {
    throw new EucalyptusCloudException("String_Node_Str" + sizeFromRequest + "String_Node_Str");
  }
  final Integer newSize=sizeFromRequest != null ? sizeFromRequest : (snapId != null ? snapSize : new Integer(-1));
  Exception lastEx=null;
  for (int i=0; i < VOL_CREATE_RETRIES; i++) {
    try {
      final ServiceConfiguration sc=Topology.lookup(Storage.class,Partitions.lookupByName(partition));
      final UserFullName owner=ctx.getUserFullName();
      Function<Long,Volume> allocator=new Function<Long,Volume>(){
        @Override public Volume apply(        Long size){
          try {
            return Volumes.createStorageVolume(sc,owner,snapId,Ints.checkedCast(size),request);
          }
 catch (          ExecutionException ex) {
            throw Exceptions.toUndeclared(ex);
          }
        }
      }
;
      Volume newVol=RestrictedTypes.allocateMeasurableResource(newSize.longValue(),allocator);
      CreateVolumeResponseType reply=request.getReply();
      reply.setVolume(newVol.morph(new com.eucalyptus.compute.common.Volume()));
      return reply;
    }
 catch (    RuntimeException ex) {
      LOG.error(ex,ex);
      final VolumeSizeExceededException volumeSizeException=Exceptions.findCause(ex,VolumeSizeExceededException.class);
      if (volumeSizeException != null) {
        throw new ClientComputeException("String_Node_Str","String_Node_Str" + volumeSizeException.getMessage());
      }
 else       if (!(ex.getCause() instanceof ExecutionException)) {
        throw ex;
      }
 else {
        lastEx=ex;
      }
    }
  }
  throw new EucalyptusCloudException("String_Node_Str" + VOL_CREATE_RETRIES + "String_Node_Str"+ lastEx,lastEx);
}

Fixed version (ground truth):
public CreateVolumeResponseType CreateVolume(final CreateVolumeType request) throws EucalyptusCloudException, AuthException {
  Context ctx=Contexts.lookup();
  Long volSize=request.getSize() != null ? Long.parseLong(request.getSize()) : null;
  final String snapId=normalizeOptionalSnapshotIdentifier(request.getSnapshotId());
  Integer snapSize=0;
  String partition=request.getAvailabilityZone();
  if ((request.getSnapshotId() == null && request.getSize() == null)) {
    throw new EucalyptusCloudException("String_Node_Str");
  }
  if (snapId != null) {
    try {
      Snapshot snap=Transactions.find(Snapshot.named(null,normalizeOptionalSnapshotIdentifier(snapId)));
      snapSize=snap.getVolumeSize();
      if (!Predicates.and(Snapshots.FilterPermissions.INSTANCE,RestrictedTypes.filterPrivilegedWithoutOwner()).apply(snap)) {
        throw new ClientUnauthorizedComputeException("String_Node_Str" + snapId + "String_Node_Str"+ ctx.getUser().getName());
      }
      if (volSize != null && snap != null && snap.getVolumeSize() != null && volSize < snap.getVolumeSize()) {
        throw new EucalyptusCloudException("String_Node_Str");
      }
    }
 catch (    ExecutionException ex) {
      throw new EucalyptusCloudException("String_Node_Str" + snapId);
    }
  }
  final Integer sizeFromRequest=request.getSize() != null ? new Integer(request.getSize()) : null;
  if (sizeFromRequest != null && sizeFromRequest <= 0) {
    throw new EucalyptusCloudException("String_Node_Str" + sizeFromRequest + "String_Node_Str");
  }
  final Integer newSize=sizeFromRequest != null ? sizeFromRequest : (snapId != null ? snapSize : new Integer(-1));
  Exception lastEx=null;
  for (int i=0; i < VOL_CREATE_RETRIES; i++) {
    try {
      final ServiceConfiguration sc=Topology.lookup(Storage.class,Partitions.lookupByName(partition));
      final UserFullName owner=ctx.getUserFullName();
      Function<Long,Volume> allocator=new Function<Long,Volume>(){
        @Override public Volume apply(        Long size){
          try {
            return Volumes.createStorageVolume(sc,owner,snapId,Ints.checkedCast(size),request);
          }
 catch (          ExecutionException ex) {
            throw Exceptions.toUndeclared(ex);
          }
        }
      }
;
      Volume newVol=RestrictedTypes.allocateMeasurableResource(newSize.longValue(),allocator);
      CreateVolumeResponseType reply=request.getReply();
      reply.setVolume(newVol.morph(new com.eucalyptus.compute.common.Volume()));
      return reply;
    }
 catch (    RuntimeException ex) {
      final VolumeSizeExceededException volumeSizeException=Exceptions.findCause(ex,VolumeSizeExceededException.class);
      if (volumeSizeException != null) {
        throw new ClientComputeException("String_Node_Str","String_Node_Str" + volumeSizeException.getMessage());
      }
 else       if (!(ex.getCause() instanceof ExecutionException)) {
        throw handleException(ex);
      }
 else {
        lastEx=ex;
      }
    }
  }
  throw new EucalyptusCloudException("String_Node_Str" + VOL_CREATE_RETRIES + "String_Node_Str"+ lastEx,lastEx);
}