Program: 6768
Project: 6768
Buggy source:
/** 
 * Performs resource assignment based on the resource requirement. This method should only be called from the single thread executor owned by this class.
 * @param requirement The resource requirement that needs to be fulfilled.
 * @param handlers The set of handlers available.
 */
private void performAssignment(ResourceRequirement requirement,Set<Discoverable> handlers){
  ResourceAssignment oldAssignment=assignments.get(requirement.getName());
  if (oldAssignment == null) {
    fetchAndPerformAssignment(requirement,handlers);
    return;
  }
  Map<String,Integer> partitions=Maps.newHashMap();
  for (  ResourceRequirement.Partition partition : requirement.getPartitions()) {
    partitions.put(partition.getName(),partition.getReplicas());
  }
  Multimap<Discoverable,PartitionReplica> assignmentMap=TreeMultimap.create(DiscoverableComparator.COMPARATOR,PartitionReplica.COMPARATOR);
  for (  Map.Entry<Discoverable,PartitionReplica> entry : oldAssignment.getAssignments().entries()) {
    Integer replicas=partitions.get(entry.getValue().getName());
    if (replicas != null && entry.getValue().getReplicaId() < replicas && handlers.contains(entry.getKey())) {
      assignmentMap.put(entry.getKey(),entry.getValue());
    }
  }
  ResourceAssigner<Discoverable> assigner=DefaultResourceAssigner.create(assignmentMap);
  if (!handlers.isEmpty() && !partitions.isEmpty()) {
    assignmentStrategy.assign(requirement,handlers,assigner);
  }
  saveAssignment(new ResourceAssignment(requirement.getName(),assigner.get()));
}

Fixed version (ground truth):
/** 
 * Performs resource assignment based on the resource requirement. This method should only be called from the single thread executor owned by this class.
 * @param requirement The resource requirement that needs to be fulfilled.
 * @param serviceDiscovered The set of handlers available.
 */
private void performAssignment(ResourceRequirement requirement,ServiceDiscovered serviceDiscovered){
  ResourceAssignment oldAssignment=assignments.get(requirement.getName());
  if (oldAssignment == null) {
    fetchAndPerformAssignment(requirement,serviceDiscovered);
    return;
  }
  Set<Discoverable> handlers=ImmutableSortedSet.copyOf(DiscoverableComparator.COMPARATOR,serviceDiscovered);
  LOG.info("String_Node_Str",requirement,handlers.size());
  Map<String,Integer> partitions=Maps.newHashMap();
  for (  ResourceRequirement.Partition partition : requirement.getPartitions()) {
    partitions.put(partition.getName(),partition.getReplicas());
  }
  Multimap<Discoverable,PartitionReplica> assignmentMap=TreeMultimap.create(DiscoverableComparator.COMPARATOR,PartitionReplica.COMPARATOR);
  for (  Map.Entry<Discoverable,PartitionReplica> entry : oldAssignment.getAssignments().entries()) {
    Integer replicas=partitions.get(entry.getValue().getName());
    if (replicas != null && entry.getValue().getReplicaId() < replicas && handlers.contains(entry.getKey())) {
      assignmentMap.put(entry.getKey(),entry.getValue());
    }
  }
  ResourceAssigner<Discoverable> assigner=DefaultResourceAssigner.create(assignmentMap);
  if (!handlers.isEmpty() && !partitions.isEmpty()) {
    assignmentStrategy.assign(requirement,handlers,assigner);
  }
  saveAssignment(new ResourceAssignment(requirement.getName(),assigner.get()));
}