Program: 14403
Project: 14403
Buggy source:
public List<String> createSnapshot(String volumeId,String snapshotId,Boolean shouldTransferSnapshot) throws EucalyptusCloudException {
  updateVolumeGroup();
  VolumeEntityWrapperManager volumeManager=new VolumeEntityWrapperManager();
  LVMVolumeInfo foundLVMVolumeInfo=volumeManager.getVolumeInfo(volumeId);
  ArrayList<String> returnValues=new ArrayList<String>();
  if (foundLVMVolumeInfo != null) {
    LVMVolumeInfo snapshotInfo=volumeManager.getVolumeInfo();
    snapshotInfo.setVolumeId(snapshotId);
    File snapshotDir=new File(DirectStorageInfo.getStorageInfo().getVolumesDir());
    snapshotDir.mkdirs();
    String lvName="String_Node_Str" + Hashes.getRandom(4);
    String absoluteLVName=lvmRootDirectory + PATH_SEPARATOR + volumeGroup+ PATH_SEPARATOR+ foundLVMVolumeInfo.getLvName();
    int size=foundLVMVolumeInfo.getSize();
    volumeManager.finish();
    volumeManager=null;
    try {
      String returnValue=createSnapshotLogicalVolume(absoluteLVName,lvName,size);
      if (returnValue.length() == 0) {
        throw new EucalyptusCloudException("String_Node_Str" + lvName + "String_Node_Str"+ lvName);
      }
      String snapRawFileName=DirectStorageInfo.getStorageInfo().getVolumesDir() + "String_Node_Str" + snapshotId;
      String absoluteSnapLVName=lvmRootDirectory + PATH_SEPARATOR + volumeGroup+ PATH_SEPARATOR+ lvName;
      duplicateLogicalVolume(absoluteSnapLVName,snapRawFileName);
      returnValue=removeLogicalVolume(absoluteSnapLVName);
      if (returnValue.length() == 0) {
        throw new EucalyptusCloudException("String_Node_Str" + absoluteSnapLVName);
      }
      snapshotInfo.setLoFileName(snapRawFileName);
      snapshotInfo.setStatus(StorageProperties.Status.available.toString());
      snapshotInfo.setSize(size);
      volumeManager=new VolumeEntityWrapperManager();
      volumeManager.add(snapshotInfo);
      returnValues.add(snapRawFileName);
      returnValues.add(String.valueOf(size * WalrusProperties.G));
    }
 catch (    EucalyptusCloudException ex) {
      if (volumeManager != null)       volumeManager.abort();
      String error="String_Node_Str" + ex.getMessage();
      LOG.error(error);
      throw new EucalyptusCloudException(error);
    }
  }
  volumeManager.finish();
  return returnValues;
}

Fixed version (ground truth):
public List<String> createSnapshot(String volumeId,String snapshotId,Boolean shouldTransferSnapshot) throws EucalyptusCloudException {
  updateVolumeGroup();
  VolumeEntityWrapperManager volumeManager=new VolumeEntityWrapperManager();
  LVMVolumeInfo foundLVMVolumeInfo=volumeManager.getVolumeInfo(volumeId);
  ArrayList<String> returnValues=new ArrayList<String>();
  if (foundLVMVolumeInfo != null) {
    LVMVolumeInfo snapshotInfo=volumeManager.getVolumeInfo();
    snapshotInfo.setVolumeId(snapshotId);
    File snapshotDir=new File(DirectStorageInfo.getStorageInfo().getVolumesDir());
    snapshotDir.mkdirs();
    String lvName="String_Node_Str" + Hashes.getRandom(4);
    String absoluteLVName=lvmRootDirectory + PATH_SEPARATOR + volumeGroup+ PATH_SEPARATOR+ foundLVMVolumeInfo.getLvName();
    int size=foundLVMVolumeInfo.getSize();
    volumeManager.finish();
    volumeManager=null;
    try {
      long absoluteSize;
      CommandOutput result=SystemUtil.runWithRawOutput(new String[]{EUCA_ROOT_WRAPPER,"String_Node_Str","String_Node_Str",absoluteLVName});
      if (null != result && result.returnValue == 0 && StringUtils.isNotBlank(StringUtils.trim(result.output))) {
        try {
          absoluteSize=(Long.parseLong(StringUtils.trim(result.output)) / StorageProperties.MB);
        }
 catch (        NumberFormatException e) {
          LOG.debug("String_Node_Str" + volumeId,e);
          absoluteSize=size * StorageProperties.KB;
        }
      }
 else {
        absoluteSize=size * StorageProperties.KB;
      }
      String returnValue=createSnapshotLogicalVolume(absoluteLVName,lvName,absoluteSize);
      if (returnValue.length() == 0) {
        throw new EucalyptusCloudException("String_Node_Str" + lvName + "String_Node_Str"+ lvName);
      }
      String snapRawFileName=DirectStorageInfo.getStorageInfo().getVolumesDir() + "String_Node_Str" + snapshotId;
      String absoluteSnapLVName=lvmRootDirectory + PATH_SEPARATOR + volumeGroup+ PATH_SEPARATOR+ lvName;
      duplicateLogicalVolume(absoluteSnapLVName,snapRawFileName);
      returnValue=removeLogicalVolume(absoluteSnapLVName);
      if (returnValue.length() == 0) {
        throw new EucalyptusCloudException("String_Node_Str" + absoluteSnapLVName);
      }
      snapshotInfo.setLoFileName(snapRawFileName);
      snapshotInfo.setSize(size);
      volumeManager=new VolumeEntityWrapperManager();
      volumeManager.add(snapshotInfo);
      returnValues.add(snapRawFileName);
      returnValues.add(String.valueOf(size * WalrusProperties.G));
    }
 catch (    Exception ex) {
      if (volumeManager != null)       volumeManager.abort();
      String error="String_Node_Str" + ex.getMessage();
      LOG.error(error);
      throw new EucalyptusCloudException(error);
    }
  }
  volumeManager.finish();
  return returnValues;
}