Program: 15224
Project: 15224
Buggy source:
@Override public void run(){
  List<ServiceConfiguration> checkServicesList=ServiceConfigurations.collect(new Predicate<ServiceConfiguration>(){
    @Override public boolean apply(    ServiceConfiguration arg0){
      if (Bootstrap.isCloudController()) {
        return true;
      }
 else {
        return arg0.isVmLocal();
      }
    }
  }
);
  LOG.debug("String_Node_Str" + Joiner.on("String_Node_Str").join(Topology.this.services.keySet()));
  LOG.debug("String_Node_Str" + Joiner.on("String_Node_Str").join(Topology.this.services.values()));
  LOG.debug("String_Node_Str" + Joiner.on("String_Node_Str").join(checkServicesList));
  Predicate<Future<?>> futureIsDone=new Predicate<Future<?>>(){
    @Override public boolean apply(    Future<?> arg0){
      return arg0.isDone();
    }
  }
;
  Map<ServiceConfiguration,Future<ServiceConfiguration>> futures=Maps.newHashMap();
  for (  ServiceConfiguration config : checkServicesList) {
    LOG.debug("String_Node_Str" + config);
    futures.put(config,Topology.getInstance().submitExternal(config,TopologyChanges.checkFunction()));
  }
  for (int i=0; i < 100 && !Iterables.all(futures.values(),futureIsDone); i++) {
    try {
      TimeUnit.MILLISECONDS.sleep(100);
    }
 catch (    InterruptedException ex) {
      LOG.error(ex,ex);
      Thread.currentThread().interrupt();
    }
  }
  List<ServiceConfiguration> disabledServices=Lists.newArrayList();
  for (  Map.Entry<ServiceConfiguration,Future<ServiceConfiguration>> result : futures.entrySet()) {
    try {
      ServiceConfiguration resultConfig=result.getValue().get();
      LOG.debug("String_Node_Str" + result.getKey());
    }
 catch (    InterruptedException ex) {
      LOG.debug("String_Node_Str" + result.getKey());
      LOG.error(ex,ex);
      Thread.currentThread().interrupt();
    }
catch (    Exception ex) {
      Throwable e=ex;
      if (ex instanceof ExecutionException) {
        LOG.debug("String_Node_Str" + result.getKey() + "String_Node_Str"+ ex.getCause().getMessage());
        e=ex.getCause();
      }
 else {
        LOG.debug("String_Node_Str" + result.getKey() + "String_Node_Str"+ ex.getMessage());
      }
      try {
        disabledServices.add(result.getKey());
        Topology.this.getGuard().tryDisable(ServiceKey.create(result.getKey()),result.getKey());
      }
 catch (      ServiceRegistrationException ex1) {
        LOG.error(ex1,ex1);
      }
      LOG.error(ex,ex);
    }
  }
  if (Bootstrap.isCloudController()) {
    List<ServiceConfiguration> failoverServicesList=ServiceConfigurations.collect(new Predicate<ServiceConfiguration>(){
      @Override public boolean apply(      ServiceConfiguration arg0){
        try {
          ServiceKey key=ServiceKey.create(arg0);
          return Bootstrap.isCloudController() && Component.State.DISABLED.isIn(arg0) && !Topology.this.services.containsKey(key);
        }
 catch (        ServiceRegistrationException ex) {
          LOG.error(ex,ex);
          return false;
        }
      }
    }
);
    failoverServicesList.removeAll(disabledServices);
    for (    ServiceConfiguration config : failoverServicesList) {
      try {
        Topology.getInstance().submitExternal(config,CloudTopologyCallables.ENABLE).get();
      }
 catch (      InterruptedException ex) {
        LOG.error(ex,ex);
        Thread.currentThread().interrupt();
      }
catch (      ExecutionException ex) {
        LOG.error(ex,ex);
      }
catch (      Exception ex) {
        LOG.error(ex,ex);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  List<ServiceConfiguration> checkServicesList=ServiceConfigurations.collect(new Predicate<ServiceConfiguration>(){
    @Override public boolean apply(    ServiceConfiguration arg0){
      if (Bootstrap.isCloudController()) {
        return true;
      }
 else {
        return arg0.isVmLocal();
      }
    }
  }
);
  LOG.debug("String_Node_Str" + Joiner.on("String_Node_Str").join(Topology.this.services.keySet()));
  LOG.debug("String_Node_Str" + Joiner.on("String_Node_Str").join(Topology.this.services.values()));
  LOG.debug("String_Node_Str" + Joiner.on("String_Node_Str").join(checkServicesList));
  Predicate<Future<?>> futureIsDone=new Predicate<Future<?>>(){
    @Override public boolean apply(    Future<?> arg0){
      return arg0.isDone();
    }
  }
;
  Map<ServiceConfiguration,Future<ServiceConfiguration>> futures=Maps.newHashMap();
  for (  ServiceConfiguration config : checkServicesList) {
    LOG.debug("String_Node_Str" + config);
    futures.put(config,Topology.getInstance().submitExternal(config,TopologyChanges.checkFunction()));
  }
  for (int i=0; i < 100 && !Iterables.all(futures.values(),futureIsDone); i++) {
    try {
      TimeUnit.MILLISECONDS.sleep(100);
    }
 catch (    InterruptedException ex) {
      LOG.error(ex,ex);
      Thread.currentThread().interrupt();
    }
  }
  List<ServiceConfiguration> disabledServices=Lists.newArrayList();
  for (  Map.Entry<ServiceConfiguration,Future<ServiceConfiguration>> result : futures.entrySet()) {
    try {
      ServiceConfiguration resultConfig=result.getValue().get();
      LOG.debug("String_Node_Str" + result.getKey());
    }
 catch (    InterruptedException ex) {
      LOG.debug("String_Node_Str" + result.getKey());
      LOG.error(ex,ex);
      Thread.currentThread().interrupt();
    }
catch (    Throwable ex) {
      Throwable e=ex;
      if (ex instanceof ExecutionException) {
        LOG.debug("String_Node_Str" + result.getKey() + "String_Node_Str"+ ex.getCause().getMessage());
        e=ex.getCause();
      }
 else {
        LOG.debug("String_Node_Str" + result.getKey() + "String_Node_Str"+ ex.getMessage());
      }
      try {
        disabledServices.add(result.getKey());
        Topology.this.getGuard().tryDisable(ServiceKey.create(result.getKey()),result.getKey());
      }
 catch (      ServiceRegistrationException ex1) {
        LOG.error(ex1,ex1);
      }
      LOG.error(ex,ex);
    }
  }
  if (Bootstrap.isCloudController()) {
    List<ServiceConfiguration> failoverServicesList=ServiceConfigurations.collect(new Predicate<ServiceConfiguration>(){
      @Override public boolean apply(      ServiceConfiguration arg0){
        try {
          ServiceKey key=ServiceKey.create(arg0);
          return Bootstrap.isCloudController() && Component.State.DISABLED.isIn(arg0) && !Topology.this.services.containsKey(key);
        }
 catch (        ServiceRegistrationException ex) {
          LOG.error(ex,ex);
          return false;
        }
      }
    }
);
    failoverServicesList.removeAll(disabledServices);
    for (    ServiceConfiguration config : failoverServicesList) {
      try {
        Topology.getInstance().submitExternal(config,CloudTopologyCallables.ENABLE).get();
      }
 catch (      InterruptedException ex) {
        LOG.error(ex,ex);
        Thread.currentThread().interrupt();
      }
catch (      ExecutionException ex) {
        LOG.error(ex,ex);
      }
catch (      Exception ex) {
        LOG.error(ex,ex);
      }
    }
  }
}