Program: 79538
Project: 79538
Buggy source:
/** 
 * Increases the cluster size by the given number. Returns successfully added nodes. Called when synchronized on mutex, so overriders beware!
 */
protected Collection<Entity> grow(int delta){
  List<Location> chosenLocations;
  if (isAvailabilityZoneEnabled()) {
    List<Location> subLocations=getNonFailedSubLocations();
    Multimap<Location,Entity> membersByLocation=getMembersByLocation();
    chosenLocations=getZonePlacementStrategy().locationsForAdditions(membersByLocation,subLocations,delta);
    if (chosenLocations.size() != delta) {
      throw new IllegalStateException("String_Node_Str" + Iterables.size(chosenLocations) + "String_Node_Str"+ delta+ "String_Node_Str"+ this);
    }
  }
 else {
    chosenLocations=Collections.nCopies(delta,getLocation());
  }
  List<Entity> addedEntities=Lists.newArrayList();
  Map<Entity,Location> addedEntityLocations=Maps.newLinkedHashMap();
  Map<Entity,Task<?>> tasks=Maps.newLinkedHashMap();
  for (  Location chosenLocation : chosenLocations) {
    Entity entity=addNode(chosenLocation,ImmutableMap.of());
    addedEntities.add(entity);
    addedEntityLocations.put(entity,chosenLocation);
    Map<String,?> args=ImmutableMap.of("String_Node_Str",ImmutableList.of(chosenLocation));
    tasks.put(entity,entity.invoke(Startable.START,args));
  }
  Map<Entity,Throwable> errors=waitForTasksOnEntityStart(tasks);
  if (isAvailabilityZoneEnabled()) {
    for (    Map.Entry<Entity,Location> entry : addedEntityLocations.entrySet()) {
      Entity entity=entry.getKey();
      Location loc=entry.getValue();
      Throwable err=errors.get(entity);
      if (err == null) {
        getZoneFailureDetector().onStartupSuccess(loc,entity);
      }
 else {
        getZoneFailureDetector().onStartupFailure(loc,entity,err);
      }
    }
  }
  if (!errors.isEmpty()) {
    if (isQuarantineEnabled()) {
      quarantineFailedNodes(errors.keySet());
    }
 else {
      cleanupFailedNodes(errors.keySet());
    }
  }
  return MutableList.<Entity>builder().addAll(addedEntities).removeAll(errors.keySet()).build();
}

Fixed version (ground truth):
/** 
 * Increases the cluster size by the given number. Returns successfully added nodes. Called when synchronized on mutex, so overriders beware!
 */
protected Collection<Entity> grow(int delta){
  List<Location> chosenLocations;
  if (isAvailabilityZoneEnabled()) {
    List<Location> subLocations=getNonFailedSubLocations();
    Multimap<Location,Entity> membersByLocation=getMembersByLocation();
    chosenLocations=getZonePlacementStrategy().locationsForAdditions(membersByLocation,subLocations,delta);
    if (chosenLocations.size() != delta) {
      throw new IllegalStateException("String_Node_Str" + Iterables.size(chosenLocations) + "String_Node_Str"+ delta+ "String_Node_Str"+ this);
    }
  }
 else {
    chosenLocations=Collections.nCopies(delta,getLocation());
  }
  List<Entity> addedEntities=Lists.newArrayList();
  Map<Entity,Location> addedEntityLocations=Maps.newLinkedHashMap();
  Map<Entity,Task<?>> tasks=Maps.newLinkedHashMap();
  for (  Location chosenLocation : chosenLocations) {
    Entity entity=addNode(chosenLocation,ImmutableMap.of());
    addedEntities.add(entity);
    addedEntityLocations.put(entity,chosenLocation);
    Map<String,?> args=ImmutableMap.of("String_Node_Str",ImmutableList.of(chosenLocation));
    Task<Void> task=Effectors.invocation(entity,Startable.START,args).asTask();
    tasks.put(entity,task);
  }
  DynamicTasks.queueIfPossible(Tasks.parallel("String_Node_Str" + tasks.size() + "String_Node_Str"+ Strings.s(tasks.size())+ "String_Node_Str",tasks.values())).orSubmitAsync(this);
  Map<Entity,Throwable> errors=waitForTasksOnEntityStart(tasks);
  if (isAvailabilityZoneEnabled()) {
    for (    Map.Entry<Entity,Location> entry : addedEntityLocations.entrySet()) {
      Entity entity=entry.getKey();
      Location loc=entry.getValue();
      Throwable err=errors.get(entity);
      if (err == null) {
        getZoneFailureDetector().onStartupSuccess(loc,entity);
      }
 else {
        getZoneFailureDetector().onStartupFailure(loc,entity,err);
      }
    }
  }
  if (!errors.isEmpty()) {
    if (isQuarantineEnabled()) {
      quarantineFailedNodes(errors.keySet());
    }
 else {
      cleanupFailedNodes(errors.keySet());
    }
  }
  return MutableList.<Entity>builder().addAll(addedEntities).removeAll(errors.keySet()).build();
}