Program: 14689
Project: 14689
Buggy source:
public static ArrayList<edu.ucsb.eucalyptus.msgs.Volume> getVolumeReply(Map<String,AttachedVolume> attachedVolumes,List<Volume> volumes) throws EucalyptusCloudException {
  Multimap<String,Volume> partitionVolumeMap=HashMultimap.create();
  Map<String,StorageVolume> idStorageVolumeMap=Maps.newHashMap();
  for (  Volume v : volumes) {
    partitionVolumeMap.put(v.getPartition(),v);
  }
  ArrayList<edu.ucsb.eucalyptus.msgs.Volume> reply=Lists.newArrayList();
  for (  String partition : partitionVolumeMap.keySet()) {
    try {
      ServiceConfiguration scConfig=Partitions.lookupService(Storage.class,partition);
      Iterator<String> volumeNames=Iterators.transform(partitionVolumeMap.get(partition).iterator(),new Function<Volume,String>(){
        @Override public String apply(        Volume arg0){
          return arg0.getDisplayName();
        }
      }
);
      DescribeStorageVolumesType descVols=new DescribeStorageVolumesType(Lists.newArrayList(volumeNames));
      Dispatcher sc=ServiceDispatcher.lookup(scConfig);
      DescribeStorageVolumesResponseType volState=sc.send(descVols);
      for (      StorageVolume vol : volState.getVolumeSet()) {
        idStorageVolumeMap.put(vol.getVolumeId(),vol);
      }
      for (      Volume v : volumes) {
        if (!partition.equals(v.getPartition()))         continue;
        String status=null;
        Integer size=0;
        String actualDeviceName="String_Node_Str";
        if (idStorageVolumeMap.containsKey(v.getDisplayName())) {
          StorageVolume vol=idStorageVolumeMap.get(v.getDisplayName());
          status=vol.getStatus();
          size=Integer.parseInt(vol.getSize());
          actualDeviceName=vol.getActualDeviceName();
        }
 else {
          v.setState(State.ANNIHILATED);
        }
        if (attachedVolumes.containsKey(v.getDisplayName())) {
          v.setState(State.BUSY);
        }
 else         if (status != null) {
          v.setMappedState(status);
        }
        if (v.getSize() <= 0) {
          v.setSize(new Integer(size));
        }
        if ("String_Node_Str".equals(v.getRemoteDevice()) || "String_Node_Str".equals(v.getRemoteDevice()) || v.getRemoteDevice() == null) {
          v.setRemoteDevice(actualDeviceName);
        }
        edu.ucsb.eucalyptus.msgs.Volume aVolume=v.morph(new edu.ucsb.eucalyptus.msgs.Volume());
        if (attachedVolumes.containsKey(v.getDisplayName())) {
          aVolume.setStatus(v.mapState());
          aVolume.getAttachmentSet().add(attachedVolumes.get(aVolume.getVolumeId()));
          for (          AttachedVolume attachedVolume : aVolume.getAttachmentSet()) {
            if (!attachedVolume.getDevice().startsWith("String_Node_Str")) {
              attachedVolume.setDevice("String_Node_Str" + attachedVolume.getDevice());
            }
          }
        }
        if ("String_Node_Str".equals(v.getRemoteDevice()) && !State.FAIL.equals(v.getState())) {
          aVolume.setStatus("String_Node_Str");
        }
        reply.add(aVolume);
      }
    }
 catch (    NoSuchElementException ex) {
      LOG.error(ex,ex);
    }
catch (    NumberFormatException ex) {
      LOG.error(ex,ex);
    }
  }
  return reply;
}

Fixed version (ground truth):
public static ArrayList<edu.ucsb.eucalyptus.msgs.Volume> getVolumeReply(Map<String,AttachedVolume> attachedVolumes,List<Volume> volumes) throws EucalyptusCloudException {
  Multimap<String,Volume> partitionVolumeMap=HashMultimap.create();
  Map<String,StorageVolume> idStorageVolumeMap=Maps.newHashMap();
  for (  Volume v : volumes) {
    partitionVolumeMap.put(v.getPartition(),v);
  }
  ArrayList<edu.ucsb.eucalyptus.msgs.Volume> reply=Lists.newArrayList();
  for (  String partition : partitionVolumeMap.keySet()) {
    try {
      ServiceConfiguration scConfig=Topology.lookup(Storage.class,Partitions.lookupByName(partition));
      Iterator<String> volumeNames=Iterators.transform(partitionVolumeMap.get(partition).iterator(),new Function<Volume,String>(){
        @Override public String apply(        Volume arg0){
          return arg0.getDisplayName();
        }
      }
);
      DescribeStorageVolumesType descVols=new DescribeStorageVolumesType(Lists.newArrayList(volumeNames));
      Dispatcher sc=ServiceDispatcher.lookup(scConfig);
      DescribeStorageVolumesResponseType volState=sc.send(descVols);
      for (      StorageVolume vol : volState.getVolumeSet()) {
        idStorageVolumeMap.put(vol.getVolumeId(),vol);
      }
      for (      Volume v : volumes) {
        if (!partition.equals(v.getPartition()))         continue;
        String status=null;
        Integer size=0;
        String actualDeviceName="String_Node_Str";
        if (idStorageVolumeMap.containsKey(v.getDisplayName())) {
          StorageVolume vol=idStorageVolumeMap.get(v.getDisplayName());
          status=vol.getStatus();
          size=Integer.parseInt(vol.getSize());
          actualDeviceName=vol.getActualDeviceName();
        }
 else {
          v.setState(State.ANNIHILATED);
        }
        if (attachedVolumes.containsKey(v.getDisplayName())) {
          v.setState(State.BUSY);
        }
 else         if (status != null) {
          v.setMappedState(status);
        }
        if (v.getSize() <= 0) {
          v.setSize(new Integer(size));
        }
        if ("String_Node_Str".equals(v.getRemoteDevice()) || "String_Node_Str".equals(v.getRemoteDevice()) || v.getRemoteDevice() == null) {
          v.setRemoteDevice(actualDeviceName);
        }
        edu.ucsb.eucalyptus.msgs.Volume aVolume=v.morph(new edu.ucsb.eucalyptus.msgs.Volume());
        if (attachedVolumes.containsKey(v.getDisplayName())) {
          aVolume.setStatus(v.mapState());
          aVolume.getAttachmentSet().add(attachedVolumes.get(aVolume.getVolumeId()));
          for (          AttachedVolume attachedVolume : aVolume.getAttachmentSet()) {
            if (!attachedVolume.getDevice().startsWith("String_Node_Str")) {
              attachedVolume.setDevice("String_Node_Str" + attachedVolume.getDevice());
            }
          }
        }
        if ("String_Node_Str".equals(v.getRemoteDevice()) && !State.FAIL.equals(v.getState())) {
          aVolume.setStatus("String_Node_Str");
        }
        reply.add(aVolume);
      }
    }
 catch (    NoSuchElementException ex) {
      LOG.error(ex,ex);
    }
catch (    NumberFormatException ex) {
      LOG.error(ex,ex);
    }
  }
  return reply;
}