Program: 172927
Project: 172927
Buggy source:
/** 
 * Method used to progress work
 */
public void progress(){
  for (  int t : messages.keySet()) {
    if (batchDone.get(t)) {
      continue;
    }
    boolean allFinished=true;
    Map<Integer,Queue<Object>> map=messages.get(t);
    Map<Integer,Boolean> finishedForTarget=finished.get(t);
    Map<Integer,Integer> countMap=counts.get(t);
    Map<Integer,Integer> totalCountMap=totalCounts.get(t);
    boolean found=true;
    for (    Map.Entry<Integer,Queue<Object>> e : map.entrySet()) {
      if (e.getValue().size() == 0 && !finishedForTarget.get(e.getKey())) {
        found=false;
      }
      if (!finishedForTarget.get(e.getKey())) {
        allFinished=false;
      }
    }
    if (found) {
      List<Object> out=new ArrayList<>();
      for (      Map.Entry<Integer,Queue<Object>> e : map.entrySet()) {
        Queue<Object> valueList=e.getValue();
        if (valueList.size() > 0) {
          Object value=valueList.poll();
          out.add(value);
          allFinished=false;
        }
      }
      for (      Map.Entry<Integer,Integer> e : countMap.entrySet()) {
        Integer i=e.getValue();
        e.setValue(i - 1);
      }
      finalMessages.get(t).addAll(out);
    }
 else {
      allFinished=false;
    }
    if (allFinished) {
      batchDone.put(t,true);
      Object previous=null;
      List<Object> finalMessagePerTask=finalMessages.get(t);
      for (int i=0; i < finalMessagePerTask.size(); i++) {
        if (previous == null) {
          previous=finalMessagePerTask.get(i);
        }
 else {
          Object current=finalMessagePerTask.get(i);
          previous=reduceFunction.reduce(previous,current);
        }
      }
      reduceReceiver.receive(t,previous);
    }
  }
}

Fixed version (ground truth):
/** 
 * Method used to progress work
 */
public void progress(){
  for (  int t : messages.keySet()) {
    if (batchDone.get(t)) {
      continue;
    }
    boolean allFinished=true;
    Map<Integer,Queue<Object>> map=messages.get(t);
    Map<Integer,Boolean> finishedForTarget=finished.get(t);
    Map<Integer,Integer> countMap=counts.get(t);
    Map<Integer,Integer> totalCountMap=totalCounts.get(t);
    boolean found=true;
    for (    Map.Entry<Integer,Queue<Object>> e : map.entrySet()) {
      if (e.getValue().size() == 0 && !finishedForTarget.get(e.getKey())) {
        found=false;
      }
      if (!finishedForTarget.get(e.getKey())) {
        allFinished=false;
      }
    }
    if (found) {
      List<Object> out=new ArrayList<>();
      for (      Map.Entry<Integer,Queue<Object>> e : map.entrySet()) {
        Queue<Object> valueList=e.getValue();
        if (valueList.size() > 0) {
          Object value=valueList.poll();
          out.add(value);
          allFinished=false;
        }
      }
      for (      Map.Entry<Integer,Integer> e : countMap.entrySet()) {
        Integer i=e.getValue();
        e.setValue(i - 1);
      }
      finalMessages.get(t).addAll(out);
    }
 else {
      allFinished=false;
    }
    if (allFinished) {
      batchDone.put(t,true);
      Object previous=null;
      List<Object> finalMessagePerTask=finalMessages.get(t);
      for (int i=0; i < finalMessagePerTask.size(); i++) {
        if (previous == null) {
          previous=finalMessagePerTask.get(i);
        }
 else {
          Object current=finalMessagePerTask.get(i);
          previous=reduceFunction.reduce(previous,current);
        }
      }
      reduceReceiver.receive(t,previous);
      onFinish(t);
    }
  }
}