Program: 14243
Project: 14243
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 (!RestrictedTypes.filterPrivileged().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 edu.ucsb.eucalyptus.msgs.Volume()));
      return reply;
    }
 catch (    RuntimeException ex) {
      LOG.error(ex,ex);
      if ((ex.getMessage().contains("String_Node_Str"))) {
        String[] msg=ex.getMessage().split("String_Node_Str");
        String parsedMsg=msg[7].trim() + msg[8].substring(0,13);
        throw new EucalyptusCloudException("String_Node_Str" + parsedMsg);
      }
 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 (!RestrictedTypes.filterPrivileged().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 edu.ucsb.eucalyptus.msgs.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);
}