Program: 14406
Project: 14406
Buggy source:
public void cloneVolume(String volumeId,String parentVolumeId) throws EucalyptusCloudException {
  updateVolumeGroup();
  VolumeEntityWrapperManager volumeManager=new VolumeEntityWrapperManager();
  LVMVolumeInfo foundVolumeInfo=volumeManager.getVolumeInfo(parentVolumeId);
  if (foundVolumeInfo != null) {
    String status=foundVolumeInfo.getStatus();
    String lvName="String_Node_Str" + Hashes.getRandom(4);
    LVMVolumeInfo lvmVolumeInfo=volumeManager.getVolumeInfo();
    String parentLvName=foundVolumeInfo.getLvName();
    int size=foundVolumeInfo.getSize();
    volumeManager.finish();
    try {
      File parentVolumeFile=new File(DirectStorageInfo.getStorageInfo().getVolumesDir() + PATH_SEPARATOR + parentVolumeId);
      assert(parentVolumeFile.exists());
      createLogicalVolume(lvName,size);
      String absoluteLVName=lvmRootDirectory + PATH_SEPARATOR + volumeGroup+ PATH_SEPARATOR+ lvName;
      String absoluteParentLVName=lvmRootDirectory + PATH_SEPARATOR + volumeGroup+ PATH_SEPARATOR+ parentLvName;
      duplicateLogicalVolume(absoluteParentLVName,absoluteLVName);
      try {
        volumeManager.exportVolume(lvmVolumeInfo,volumeGroup,lvName);
      }
 catch (      EucalyptusCloudException ex) {
        String returnValue=removeLogicalVolume(absoluteLVName);
        throw ex;
      }
      lvmVolumeInfo.setVolumeId(volumeId);
      lvmVolumeInfo.setLvName(lvName);
      lvmVolumeInfo.setStatus(StorageProperties.Status.available.toString());
      lvmVolumeInfo.setSize(size);
      volumeManager=new VolumeEntityWrapperManager();
      volumeManager.add(lvmVolumeInfo);
      volumeManager.finish();
    }
 catch (    EucalyptusCloudException ex) {
      volumeManager.abort();
      String error="String_Node_Str" + ex.getMessage();
      LOG.error(error);
      throw new EucalyptusCloudException(error);
    }
  }
 else {
    volumeManager.abort();
    throw new EucalyptusCloudException("String_Node_Str" + parentVolumeId);
  }
}

Fixed version (ground truth):
public void cloneVolume(String volumeId,String parentVolumeId) throws EucalyptusCloudException {
  updateVolumeGroup();
  VolumeEntityWrapperManager volumeManager=new VolumeEntityWrapperManager();
  LVMVolumeInfo foundVolumeInfo=volumeManager.getVolumeInfo(parentVolumeId);
  if (foundVolumeInfo != null) {
    String status=foundVolumeInfo.getStatus();
    String lvName="String_Node_Str" + Hashes.getRandom(4);
    LVMVolumeInfo lvmVolumeInfo=volumeManager.getVolumeInfo();
    String parentLvName=foundVolumeInfo.getLvName();
    int size=foundVolumeInfo.getSize();
    volumeManager.finish();
    try {
      File parentVolumeFile=new File(DirectStorageInfo.getStorageInfo().getVolumesDir() + PATH_SEPARATOR + parentVolumeId);
      assert(parentVolumeFile.exists());
      long absouluteSize=(parentVolumeFile.length() / StorageProperties.MB);
      createLogicalVolume(lvName,absouluteSize);
      String absoluteLVName=lvmRootDirectory + PATH_SEPARATOR + volumeGroup+ PATH_SEPARATOR+ lvName;
      String absoluteParentLVName=lvmRootDirectory + PATH_SEPARATOR + volumeGroup+ PATH_SEPARATOR+ parentLvName;
      duplicateLogicalVolume(absoluteParentLVName,absoluteLVName);
      try {
        volumeManager.exportVolume(lvmVolumeInfo,volumeGroup,lvName);
      }
 catch (      EucalyptusCloudException ex) {
        String returnValue=removeLogicalVolume(absoluteLVName);
        throw ex;
      }
      lvmVolumeInfo.setVolumeId(volumeId);
      lvmVolumeInfo.setLvName(lvName);
      lvmVolumeInfo.setStatus(StorageProperties.Status.available.toString());
      lvmVolumeInfo.setSize(size);
      volumeManager=new VolumeEntityWrapperManager();
      volumeManager.add(lvmVolumeInfo);
      volumeManager.finish();
    }
 catch (    EucalyptusCloudException ex) {
      volumeManager.abort();
      String error="String_Node_Str" + ex.getMessage();
      LOG.error(error);
      throw new EucalyptusCloudException(error);
    }
  }
 else {
    volumeManager.abort();
    throw new EucalyptusCloudException("String_Node_Str" + parentVolumeId);
  }
}