Program: 14510
Project: 14510
Buggy source:
public DetachVolumeResponseType detach(DetachVolumeType request) throws EucalyptusCloudException {
  DetachVolumeResponseType reply=(DetachVolumeResponseType)request.getReply();
  Context ctx=Contexts.lookup();
  Volume vol;
  try {
    vol=Volumes.lookup(ctx.getUserFullName().asAccountFullName(),request.getVolumeId());
  }
 catch (  Exception ex1) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getVolumeId());
  }
  if (!RestrictedTypes.filterPrivileged().apply(vol)) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getVolumeId() + "String_Node_Str"+ ctx.getUser().getName());
  }
  VmInstance vm=null;
  AttachedVolume volume=null;
  try {
    VmVolumeAttachment vmVolAttach=VmInstances.lookupVolumeAttachment(request.getVolumeId());
    volume=VmVolumeAttachment.asAttachedVolume(vmVolAttach.getVmInstance()).apply(vmVolAttach);
    vm=vmVolAttach.getVmInstance();
  }
 catch (  NoSuchElementException ex) {
  }
  if (volume == null) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getVolumeId());
  }
  if (!RestrictedTypes.filterPrivileged().apply(vm)) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId() + "String_Node_Str"+ ctx.getUser().getName());
  }
  if (!vm.getInstanceId().equals(request.getInstanceId()) && request.getInstanceId() != null && !request.getInstanceId().equals("String_Node_Str")) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId());
  }
  if (request.getDevice() != null && !request.getDevice().equals("String_Node_Str") && !volume.getDevice().equals(request.getDevice())) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getDevice());
  }
  Cluster cluster=null;
  ServiceConfiguration ccConfig=null;
  try {
    ccConfig=Topology.lookup(ClusterController.class,vm.lookupPartition());
    cluster=Clusters.lookup(ccConfig);
  }
 catch (  NoSuchElementException e) {
    LOG.debug(e,e);
    throw new EucalyptusCloudException("String_Node_Str" + vm.getPartition());
  }
  ServiceConfiguration scVm;
  try {
    scVm=Topology.lookup(Storage.class,vm.lookupPartition());
  }
 catch (  Exception ex) {
    LOG.error(ex,ex);
    throw new EucalyptusCloudException("String_Node_Str" + vm.getPartition(),ex);
  }
  request.setVolumeId(volume.getVolumeId());
  request.setRemoteDevice(volume.getRemoteDevice());
  request.setDevice(volume.getDevice().replaceAll("String_Node_Str","String_Node_Str"));
  request.setInstanceId(vm.getInstanceId());
  VolumeDetachCallback ncDetach=new VolumeDetachCallback(request);
  try {
    AsyncRequests.sendSync(scVm,new DetachStorageVolumeType(cluster.getNode(vm.getServiceTag()).getIqn(),volume.getVolumeId()));
  }
 catch (  Exception e) {
    LOG.debug(e);
    Logs.extreme().debug(e,e);
  }
  AsyncRequests.newRequest(ncDetach).dispatch(cluster.getConfiguration());
  EventRecord.here(VolumeManager.class,EventClass.VOLUME,EventType.VOLUME_DETACH).withDetails(vm.getOwner().toString(),volume.getVolumeId(),"String_Node_Str",vm.getInstanceId()).withDetails("String_Node_Str",ccConfig.getFullName().toString()).info();
  volume.setStatus("String_Node_Str");
  reply.setDetachedVolume(volume);
  return reply;
}

Fixed version (ground truth):
public DetachVolumeResponseType detach(DetachVolumeType request) throws EucalyptusCloudException {
  DetachVolumeResponseType reply=(DetachVolumeResponseType)request.getReply();
  Context ctx=Contexts.lookup();
  Volume vol;
  try {
    vol=Volumes.lookup(ctx.getUserFullName().asAccountFullName(),request.getVolumeId());
  }
 catch (  Exception ex1) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getVolumeId());
  }
  if (!RestrictedTypes.filterPrivileged().apply(vol)) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getVolumeId() + "String_Node_Str"+ ctx.getUser().getName());
  }
  VmInstance vm=null;
  AttachedVolume volume=null;
  try {
    VmVolumeAttachment vmVolAttach=VmInstances.lookupVolumeAttachment(request.getVolumeId());
    volume=VmVolumeAttachment.asAttachedVolume(vmVolAttach.getVmInstance()).apply(vmVolAttach);
    vm=vmVolAttach.getVmInstance();
  }
 catch (  NoSuchElementException ex) {
  }
  if (volume == null) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getVolumeId());
  }
  if (!RestrictedTypes.filterPrivileged().apply(vm)) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId() + "String_Node_Str"+ ctx.getUser().getName());
  }
  if (!vm.getInstanceId().equals(request.getInstanceId()) && request.getInstanceId() != null && !request.getInstanceId().equals("String_Node_Str")) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId());
  }
  if (request.getDevice() != null && !request.getDevice().equals("String_Node_Str") && !volume.getDevice().equals(request.getDevice())) {
    throw new EucalyptusCloudException("String_Node_Str" + request.getDevice());
  }
  Cluster cluster=null;
  ServiceConfiguration ccConfig=null;
  try {
    ccConfig=Topology.lookup(ClusterController.class,vm.lookupPartition());
    cluster=Clusters.lookup(ccConfig);
  }
 catch (  NoSuchElementException e) {
    LOG.debug(e,e);
    throw new EucalyptusCloudException("String_Node_Str" + vm.getPartition());
  }
  ServiceConfiguration scVm;
  try {
    scVm=Topology.lookup(Storage.class,vm.lookupPartition());
  }
 catch (  Exception ex) {
    LOG.error(ex,ex);
    throw new EucalyptusCloudException("String_Node_Str" + vm.getPartition(),ex);
  }
  request.setVolumeId(volume.getVolumeId());
  request.setRemoteDevice(volume.getRemoteDevice());
  request.setDevice(volume.getDevice().replaceAll("String_Node_Str","String_Node_Str"));
  request.setInstanceId(vm.getInstanceId());
  VolumeDetachCallback ncDetach=new VolumeDetachCallback(request);
  try {
    AsyncRequests.sendSync(scVm,new DetachStorageVolumeType(volume.getVolumeId()));
  }
 catch (  Exception e) {
    LOG.debug(e);
    Logs.extreme().debug(e,e);
  }
  AsyncRequests.newRequest(ncDetach).dispatch(cluster.getConfiguration());
  EventRecord.here(VolumeManager.class,EventClass.VOLUME,EventType.VOLUME_DETACH).withDetails(vm.getOwner().toString(),volume.getVolumeId(),"String_Node_Str",vm.getInstanceId()).withDetails("String_Node_Str",ccConfig.getFullName().toString()).info();
  volume.setStatus("String_Node_Str");
  reply.setDetachedVolume(volume);
  return reply;
}