Program: 14286
Project: 14286
Buggy source:
public MigrateInstancesResponseType migrateInstances(final MigrateInstancesType request) throws EucalyptusCloudException {
  MigrateInstancesResponseType reply=request.getReply();
  if (!Contexts.lookup().hasAdministrativePrivileges()) {
    throw new EucalyptusCloudException("String_Node_Str");
  }
  if (!Strings.isNullOrEmpty(request.getSourceHost())) {
    for (    ServiceConfiguration ccConfig : Topology.enabledServices(ClusterController.class)) {
      try {
        ServiceConfiguration node=Nodes.lookup(ccConfig,request.getSourceHost());
        Cluster cluster=Clusters.lookup(ccConfig);
        try {
          cluster.migrateInstances(request.getSourceHost(),request.getAllowHosts(),request.getDestinationHosts());
          return reply.markWinning();
        }
 catch (        Exception ex) {
          LOG.error(ex);
          throw new EucalyptusCloudException("String_Node_Str" + request.getSourceHost() + "String_Node_Str"+ Strings.nullToEmpty(ex.getMessage()).replaceAll("String_Node_Str","String_Node_Str"),ex);
        }
      }
 catch (      EucalyptusCloudException ex) {
        throw ex;
      }
catch (      NoSuchElementException ex) {
        throw new EucalyptusCloudException("String_Node_Str" + request.getSourceHost(),ex);
      }
catch (      Exception ex) {
        LOG.error(ex);
        throw new EucalyptusCloudException("String_Node_Str" + request.getSourceHost() + "String_Node_Str"+ ex.getMessage(),ex);
      }
    }
    throw new EucalyptusCloudException("String_Node_Str" + request.getSourceHost());
  }
 else   if (!Strings.isNullOrEmpty(request.getInstanceId())) {
    VmInstance vm;
    try {
      vm=VmInstances.lookup(request.getInstanceId());
      if (!VmInstance.VmState.RUNNING.apply(vm)) {
        throw new EucalyptusCloudException("String_Node_Str" + vm.getState().name().toLowerCase() + "String_Node_Str"+ request.getInstanceId());
      }
    }
 catch (    TerminatedInstanceException ex) {
      throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId(),ex);
    }
catch (    NoSuchElementException ex) {
      throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId(),ex);
    }
    try {
      ServiceConfiguration ccConfig=Topology.lookup(ClusterController.class,vm.lookupPartition());
      Cluster cluster=Clusters.lookup(ccConfig);
      try {
        cluster.migrateInstance(request.getInstanceId(),request.getAllowHosts(),request.getDestinationHosts());
        return reply.markWinning();
      }
 catch (      Exception ex) {
        LOG.error(ex);
        throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId() + "String_Node_Str"+ Strings.nullToEmpty(ex.getMessage()).replaceAll("String_Node_Str","String_Node_Str"),ex);
      }
    }
 catch (    NoSuchElementException ex) {
      throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId(),ex);
    }
  }
 else {
    throw new EucalyptusCloudException("String_Node_Str");
  }
}

Fixed version (ground truth):
public MigrateInstancesResponseType migrateInstances(final MigrateInstancesType request) throws EucalyptusCloudException {
  MigrateInstancesResponseType reply=request.getReply();
  if (!Contexts.lookup().hasAdministrativePrivileges()) {
    throw new EucalyptusCloudException("String_Node_Str");
  }
  if (!Strings.isNullOrEmpty(request.getSourceHost())) {
    for (    ServiceConfiguration ccConfig : Topology.enabledServices(ClusterController.class)) {
      try {
        ServiceConfiguration node=Nodes.lookup(ccConfig,request.getSourceHost());
        Cluster cluster=Clusters.lookup(ccConfig);
        try {
          cluster.migrateInstances(request.getSourceHost(),request.getAllowHosts(),request.getDestinationHosts());
          return reply.markWinning();
        }
 catch (        Exception ex) {
          LOG.error(ex);
          throw new EucalyptusCloudException("String_Node_Str" + request.getSourceHost() + "String_Node_Str"+ Strings.nullToEmpty(ex.getMessage()).replaceAll("String_Node_Str","String_Node_Str"),ex);
        }
      }
 catch (      EucalyptusCloudException ex) {
        throw ex;
      }
catch (      Exception ex) {
        LOG.error(ex);
        throw new EucalyptusCloudException("String_Node_Str" + request.getSourceHost() + "String_Node_Str"+ ex.getMessage(),ex);
      }
    }
    throw new EucalyptusCloudException("String_Node_Str" + request.getSourceHost());
  }
 else   if (!Strings.isNullOrEmpty(request.getInstanceId())) {
    VmInstance vm;
    try {
      vm=VmInstances.lookup(request.getInstanceId());
      if (!VmInstance.VmState.RUNNING.apply(vm)) {
        throw new EucalyptusCloudException("String_Node_Str" + vm.getState().name().toLowerCase() + "String_Node_Str"+ request.getInstanceId());
      }
    }
 catch (    TerminatedInstanceException ex) {
      throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId(),ex);
    }
catch (    NoSuchElementException ex) {
      throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId(),ex);
    }
    try {
      ServiceConfiguration ccConfig=Topology.lookup(ClusterController.class,vm.lookupPartition());
      Cluster cluster=Clusters.lookup(ccConfig);
      try {
        cluster.migrateInstance(request.getInstanceId(),request.getAllowHosts(),request.getDestinationHosts());
        return reply.markWinning();
      }
 catch (      Exception ex) {
        LOG.error(ex);
        throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId() + "String_Node_Str"+ Strings.nullToEmpty(ex.getMessage()).replaceAll("String_Node_Str","String_Node_Str"),ex);
      }
    }
 catch (    NoSuchElementException ex) {
      throw new EucalyptusCloudException("String_Node_Str" + request.getInstanceId(),ex);
    }
  }
 else {
    throw new EucalyptusCloudException("String_Node_Str");
  }
}