nus-yam/ex-repair huggingface dataset:
Program: 172945
Project: 172945
Buggy source:
/** 
 * Add the data to the file
 * @param data
 * @param length
 */
public void add(Object key,byte[] data,int length){
  if (status == FSStatus.READING) {
    throw new RuntimeException("String_Node_Str");
  }
  Object k1=convertKeyToArray(key);
  int[] k=(int[])k1;
  try {
    int i=k[0];
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  LOG.log(Level.INFO,"String_Node_Str" + target + "String_Node_Str"+ recordsInMemory.size());
  lock.lock();
  try {
    recordsInMemory.add(new KeyValue(k1,data,keyComparator));
    bytesLength.add(length);
    numOfBytesInMemory+=length;
    if (numOfBytesInMemory > maxBytesToKeepInMemory || recordsInMemory.size() > maxRecordsInMemory) {
      notFull.signal();
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Add the data to the file
 * @param data
 * @param length
 */
public void add(Object key,byte[] data,int length){
  if (status == FSStatus.READING) {
    throw new RuntimeException("String_Node_Str");
  }
  Object k1=FileLoader.convertKeyToArray(keyType,key);
  int[] k=(int[])k1;
  try {
    int i=k[0];
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  LOG.log(Level.INFO,"String_Node_Str" + target + "String_Node_Str"+ recordsInMemory.size());
  lock.lock();
  try {
    recordsInMemory.add(new KeyValue(k1,data,keyComparator));
    bytesLength.add(length);
    numOfBytesInMemory+=length;
    if (numOfBytesInMemory > maxBytesToKeepInMemory || recordsInMemory.size() > maxRecordsInMemory) {
      notFull.signal();
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 172946
Project: 172946
Buggy source:
@Override public void init(Config cfg,int containerId,ResourcePlan plan){
  this.config=cfg;
  this.resourcePlan=plan;
  this.id=containerId;
  this.noOfTasksPerExecutor=NO_OF_TASKS / plan.noOfContainers();
  setupTasks();
  setupNetwork();
  partition=new MPIDataFlowPartition(config,channel,taskPlan,sources,destinations,new PartitionBatchFinalReceiver(new RecordSave(),true,true,new IntegerComparator()),new PartitionPartialReceiver(),MPIDataFlowPartition.PartitionStratergy.DIRECT,MessageType.BYTE,MessageType.BYTE,MessageType.INTEGER,MessageType.INTEGER,OperationSemantics.STREAMING_BATCH,new EdgeGenerator(0));
  scheduleTasks();
  progress();
}

Fixed version (ground truth):
@Override public void init(Config cfg,int containerId,ResourcePlan plan){
  this.config=cfg;
  this.resourcePlan=plan;
  this.id=containerId;
  this.noOfTasksPerExecutor=NO_OF_TASKS / plan.noOfContainers();
  setupTasks();
  setupNetwork();
  partition=new MPIDataFlowPartition(config,channel,taskPlan,sources,destinations,new PartitionBatchFinalReceiver(new RecordSave(),false,true,new IntegerComparator()),new PartitionPartialReceiver(),MPIDataFlowPartition.PartitionStratergy.DIRECT,MessageType.BYTE,MessageType.BYTE,MessageType.INTEGER,MessageType.INTEGER,OperationSemantics.STREAMING_BATCH,new EdgeGenerator(0));
  scheduleTasks();
  progress();
}
Program: 172947
Project: 172947
Buggy source:
private void scheduleTasks(){
  if (id < 2) {
    for (int i=0; i < noOfTasksPerExecutor; i++) {
      Thread mapThread=new Thread(new RecordSource(config,partition,new ArrayList<>(destinations),id,1000,10000,NO_OF_TASKS / 2));
      mapThread.start();
    }
  }
}

Fixed version (ground truth):
private void scheduleTasks(){
  if (id < NO_OF_TASKS / 2) {
    for (int i=0; i < noOfTasksPerExecutor; i++) {
      Thread mapThread=new Thread(new RecordSource(config,partition,new ArrayList<>(destinations),id,1000,10000,NO_OF_TASKS / 2));
      mapThread.start();
    }
  }
}
Program: 172948
Project: 172948
Buggy source:
public static void main(String[] args){
  Config config=ResourceAllocator.loadConfig(new HashMap<>());
  JobConfig jobConfig=new JobConfig();
  BasicJob.BasicJobBuilder jobBuilder=BasicJob.newBuilder();
  jobBuilder.setName("String_Node_Str");
  jobBuilder.setContainerClass(SortJob.class.getName());
  jobBuilder.setRequestResource(new ResourceContainer(2,1024),4);
  jobBuilder.setConfig(jobConfig);
  Twister2Submitter.submitContainerJob(jobBuilder.build(),config);
}

Fixed version (ground truth):
public static void main(String[] args){
  Config config=ResourceAllocator.loadConfig(new HashMap<>());
  JobConfig jobConfig=new JobConfig();
  BasicJob.BasicJobBuilder jobBuilder=BasicJob.newBuilder();
  jobBuilder.setName("String_Node_Str");
  jobBuilder.setContainerClass(SortJob.class.getName());
  jobBuilder.setRequestResource(new ResourceContainer(2,1024),NO_OF_TASKS);
  jobBuilder.setConfig(jobConfig);
  Twister2Submitter.submitContainerJob(jobBuilder.build(),config);
}
Program: 172949
Project: 172949
Buggy source:
public boolean sendMessage(int source,Object message,int path,int flags,RoutingParameters routingParameters){
  ArrayBlockingQueue<Pair<Object,MPISendMessage>> pendingSendMessages=pendingSendMessagesPerSource.get(source);
  if (pendingSendMessages.remainingCapacity() > 0) {
    MPIMessage mpiMessage=new MPIMessage(source,dataType,MPIMessageDirection.OUT,this);
    int di=-1;
    if (routingParameters.getExternalRoutes().size() > 0) {
      di=routingParameters.getDestinationId();
    }
    MPISendMessage sendMessage=new MPISendMessage(source,mpiMessage,edge,di,path,flags,routingParameters.getInternalRoutes(),routingParameters.getExternalRoutes());
    boolean offer=pendingSendMessages.offer(new ImmutablePair<Object,MPISendMessage>(message,sendMessage));
    if (!offer) {
      sendAttempts++;
    }
 else {
      ((TWSMPIChannel)channel).setDebug(false);
      sendAttempts=0;
      sendsOfferred++;
    }
    return offer;
  }
  return false;
}

Fixed version (ground truth):
public boolean sendMessage(int source,Object message,int path,int flags,RoutingParameters routingParameters){
  ArrayBlockingQueue<Pair<Object,MPISendMessage>> pendingSendMessages=pendingSendMessagesPerSource.get(source);
  if (pendingSendMessages == null) {
    throw new RuntimeException(String.format("String_Node_Str",executor,source));
  }
  if (pendingSendMessages.remainingCapacity() > 0) {
    MPIMessage mpiMessage=new MPIMessage(source,dataType,MPIMessageDirection.OUT,this);
    int di=-1;
    if (routingParameters.getExternalRoutes().size() > 0) {
      di=routingParameters.getDestinationId();
    }
    MPISendMessage sendMessage=new MPISendMessage(source,mpiMessage,edge,di,path,flags,routingParameters.getInternalRoutes(),routingParameters.getExternalRoutes());
    boolean offer=pendingSendMessages.offer(new ImmutablePair<Object,MPISendMessage>(message,sendMessage));
    if (!offer) {
      sendAttempts++;
    }
 else {
      ((TWSMPIChannel)channel).setDebug(false);
      sendAttempts=0;
      sendsOfferred++;
    }
    return offer;
  }
  return false;
}
Program: 172950
Project: 172950
Buggy source:
public void init(Config cfg,DataFlowOperation op,Map<Integer,List<Integer>> expectedIds){
  int maxBytesInMemory=MPIContext.getShuffleMaxBytesInMemory(cfg);
  int maxRecordsInMemory=MPIContext.getShuffleMaxRecordsInMemory(cfg);
  String path=MPIContext.getShuffleDirectoryPath(cfg);
  finished=new ConcurrentHashMap<>();
  for (  Integer target : expectedIds.keySet()) {
    Map<Integer,Boolean> perTarget=new ConcurrentHashMap<>();
    for (    Integer exp : expectedIds.get(target)) {
      perTarget.put(exp,false);
    }
    finished.put(target,perTarget);
    Shuffle sortedMerger;
    partition=(MPIDataFlowPartition)op;
    if (partition.getKeyType() == null) {
      sortedMerger=new FSMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getDataType());
    }
 else {
      if (sorted) {
        sortedMerger=new FSKeyedSortedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getKeyType(),partition.getDataType(),comparator);
      }
 else {
        sortedMerger=new FSKeyedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getKeyType(),partition.getDataType());
      }
    }
    sortedMergers.put(target,sortedMerger);
  }
  keyed=partition.getKeyType() != null;
}

Fixed version (ground truth):
public void init(Config cfg,DataFlowOperation op,Map<Integer,List<Integer>> expectedIds){
  int maxBytesInMemory=MPIContext.getShuffleMaxBytesInMemory(cfg);
  int maxRecordsInMemory=MPIContext.getShuffleMaxRecordsInMemory(cfg);
  String path=MPIContext.getShuffleDirectoryPath(cfg);
  finished=new ConcurrentHashMap<>();
  partition=(MPIDataFlowPartition)op;
  keyed=partition.getKeyType() != null;
  for (  Integer target : expectedIds.keySet()) {
    Map<Integer,Boolean> perTarget=new ConcurrentHashMap<>();
    for (    Integer exp : expectedIds.get(target)) {
      perTarget.put(exp,false);
    }
    finished.put(target,perTarget);
    Shuffle sortedMerger;
    if (partition.getKeyType() == null) {
      sortedMerger=new FSMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getDataType());
    }
 else {
      if (sorted) {
        sortedMerger=new FSKeyedSortedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getKeyType(),partition.getDataType(),comparator);
      }
 else {
        sortedMerger=new FSKeyedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getKeyType(),partition.getDataType());
      }
    }
    sortedMergers.put(target,sortedMerger);
  }
}
Program: 172951
Project: 172951
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public boolean onMessage(int source,int destination,int target,int flags,Object object){
  Shuffle sortedMerger=sortedMergers.get(target);
  if (sortedMerger == null) {
    throw new RuntimeException("String_Node_Str" + target);
  }
  if (keyed) {
    List<KeyedContent> keyedContents=(List<KeyedContent>)object;
    for (    KeyedContent kc : keyedContents) {
      Object data=kc.getValue();
      byte[] d=kryoSerializer.serialize(data);
      sortedMerger.add(kc.getKey(),d,d.length);
    }
  }
 else {
    List<Object> contents=(List<Object>)object;
    for (    Object kc : contents) {
      byte[] d=kryoSerializer.serialize(kc);
      sortedMerger.add(d,d.length);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public boolean onMessage(int source,int destination,int target,int flags,Object object){
  Shuffle sortedMerger=sortedMergers.get(target);
  if (sortedMerger == null) {
    throw new RuntimeException("String_Node_Str" + target);
  }
  LOG.info(String.format("String_Node_Str",target));
  if (keyed) {
    List<KeyedContent> keyedContents=(List<KeyedContent>)object;
    for (    KeyedContent kc : keyedContents) {
      Object data=kc.getValue();
      byte[] d=kryoSerializer.serialize(data);
      sortedMerger.add(kc.getKey(),d,d.length);
    }
  }
 else {
    List<Object> contents=(List<Object>)object;
    for (    Object kc : contents) {
      byte[] d=kryoSerializer.serialize(kc);
      sortedMerger.add(d,d.length);
    }
  }
  return true;
}
Program: 172952
Project: 172952
Buggy source:
@Override public void run(){
  for (int i=0; i < noOfWords; i++) {
    Record word=recordGenerator.next();
    int destIndex=0;
    int val=word.getKey();
    for (int j=0; j < partitioning.size() - 1; j++) {
      if (val > partitioning.get(j) && val <= partitioning.get(j + 1)) {
        destIndex=j;
      }
    }
    int dest=destinations.get(destIndex);
    int flags=0;
    if (i >= (noOfWords - noOfDestinations)) {
      flags=MessageFlags.FLAGS_LAST;
    }
    while (!operation.send(taskId,new KeyedContent(word.getKey(),word.getData(),MessageType.INTEGER,MessageType.BYTE),flags,dest)) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
  operation.finish(taskId);
}

Fixed version (ground truth):
@Override public void run(){
  for (int i=0; i < noOfWords; i++) {
    Record word=recordGenerator.next();
    int destIndex=0;
    int val=word.getKey();
    for (int j=0; j < partitioning.size() - 1; j++) {
      if (val > partitioning.get(j) && val <= partitioning.get(j + 1)) {
        destIndex=j;
      }
    }
    int dest=destinations.get(destIndex);
    int flags=0;
    if (i >= (noOfWords - noOfDestinations)) {
      flags=MessageFlags.FLAGS_LAST;
    }
    LOG.log(Level.INFO,String.format("String_Node_Str",executor,taskId,dest));
    while (!operation.send(taskId,new KeyedContent(word.getKey(),word.getData(),MessageType.INTEGER,MessageType.BYTE),flags,dest)) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
  operation.finish(taskId);
}
Program: 172953
Project: 172953
Buggy source:
@Override public void init(Config cfg,int containerId,ResourcePlan plan){
  this.config=cfg;
  this.resourcePlan=plan;
  this.id=containerId;
  this.noOfTasksPerExecutor=NO_OF_TASKS / plan.noOfContainers();
  setupTasks();
  setupNetwork();
  partition=new MPIDataFlowPartition(config,channel,taskPlan,sources,destinations,new PartitionBatchFinalReceiver(new RecordSave(),true,true),new PartitionPartialReceiver(),MPIDataFlowPartition.PartitionStratergy.DIRECT,MessageType.OBJECT,MessageType.OBJECT,null,null,OperationSemantics.STREAMING_BATCH,new EdgeGenerator(0));
  scheduleTasks();
  progress();
}

Fixed version (ground truth):
@Override public void init(Config cfg,int containerId,ResourcePlan plan){
  this.config=cfg;
  this.resourcePlan=plan;
  this.id=containerId;
  this.noOfTasksPerExecutor=NO_OF_TASKS / plan.noOfContainers();
  setupTasks();
  setupNetwork();
  partition=new MPIDataFlowPartition(config,channel,taskPlan,sources,destinations,new PartitionBatchFinalReceiver(new RecordSave(),true,true),new PartitionPartialReceiver(),MPIDataFlowPartition.PartitionStratergy.DIRECT,MessageType.BYTE,MessageType.BYTE,MessageType.INTEGER,MessageType.INTEGER,OperationSemantics.STREAMING_BATCH,new EdgeGenerator(0));
  scheduleTasks();
  progress();
}
Program: 172954
Project: 172954
Buggy source:
private void setupTasks(){
  taskPlan=WordCountUtils.createWordCountPlan(config,resourcePlan,NO_OF_TASKS + 2);
  sources=new HashSet<>();
  for (int i=0; i < NO_OF_TASKS / 2; i++) {
    sources.add(i);
  }
  destinations=new HashSet<>();
  for (int i=0; i < NO_OF_TASKS / 2; i++) {
    destinations.add(NO_OF_TASKS / 2 + i);
  }
}

Fixed version (ground truth):
private void setupTasks(){
  taskPlan=WordCountUtils.createWordCountPlan(config,resourcePlan,NO_OF_TASKS);
  sources=new HashSet<>();
  for (int i=0; i < NO_OF_TASKS / 2; i++) {
    sources.add(i);
  }
  destinations=new HashSet<>();
  for (int i=0; i < NO_OF_TASKS / 2; i++) {
    destinations.add(NO_OF_TASKS / 2 + i);
  }
}
Program: 172955
Project: 172955
Buggy source:
public static void main(String[] args){
  Config config=ResourceAllocator.loadConfig(new HashMap<>());
  JobConfig jobConfig=new JobConfig();
  BasicJob.BasicJobBuilder jobBuilder=BasicJob.newBuilder();
  jobBuilder.setName("String_Node_Str");
  jobBuilder.setContainerClass(SortJob.class.getName());
  jobBuilder.setRequestResource(new ResourceContainer(2,1024),1);
  jobBuilder.setConfig(jobConfig);
  Twister2Submitter.submitContainerJob(jobBuilder.build(),config);
}

Fixed version (ground truth):
public static void main(String[] args){
  Config config=ResourceAllocator.loadConfig(new HashMap<>());
  JobConfig jobConfig=new JobConfig();
  BasicJob.BasicJobBuilder jobBuilder=BasicJob.newBuilder();
  jobBuilder.setName("String_Node_Str");
  jobBuilder.setContainerClass(SortJob.class.getName());
  jobBuilder.setRequestResource(new ResourceContainer(2,1024),4);
  jobBuilder.setConfig(jobConfig);
  Twister2Submitter.submitContainerJob(jobBuilder.build(),config);
}
Program: 172957
Project: 172957
Buggy source:
public static void main(String[] args){
  Options cmdOptions=null;
  try {
    MPI.Init(args);
    int rank=MPI.COMM_WORLD.getRank();
    int size=MPI.COMM_WORLD.getSize();
    cmdOptions=setupOptions();
    CommandLineParser parser=new DefaultParser();
    CommandLine cmd=parser.parse(cmdOptions,args);
    Config config=loadConfigurations(cmd,rank);
    LOG.log(Level.FINE,"String_Node_Str");
    worker(config,rank);
  }
 catch (  MPIException e) {
    LOG.log(Level.SEVERE,"String_Node_Str",e);
    throw new RuntimeException(e);
  }
catch (  ParseException e) {
    HelpFormatter formatter=new HelpFormatter();
    formatter.printHelp("String_Node_Str",cmdOptions);
    throw new RuntimeException("String_Node_Str",e);
  }
 finally {
    try {
      MPI.Finalize();
    }
 catch (    MPIException ignore) {
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Options cmdOptions=null;
  try {
    MPI.Init(args);
    int rank=MPI.COMM_WORLD.getRank();
    int size=MPI.COMM_WORLD.getSize();
    cmdOptions=setupOptions();
    CommandLineParser parser=new DefaultParser();
    CommandLine cmd=parser.parse(cmdOptions,args);
    Config config=loadConfigurations(cmd,rank);
    LOG.log(Level.FINE,"String_Node_Str");
    worker(config,rank);
  }
 catch (  MPIException e) {
    LOG.log(Level.SEVERE,"String_Node_Str",e);
    throw new RuntimeException(e);
  }
catch (  ParseException e) {
    HelpFormatter formatter=new HelpFormatter();
    formatter.printHelp("String_Node_Str",cmdOptions);
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  Throwable t) {
    String msg="String_Node_Str";
    LOG.log(Level.SEVERE,msg,t);
    throw new RuntimeException(msg);
  }
 finally {
    try {
      MPI.Finalize();
    }
 catch (    MPIException ignore) {
    }
  }
}
Program: 172958
Project: 172958
Buggy source:
public void init(Config cfg,DataFlowOperation op,Map<Integer,List<Integer>> expectedIds){
  int maxBytesInMemory=MPIContext.getShuffleMaxBytesInMemory(cfg);
  int maxRecordsInMemory=MPIContext.getShuffleMaxRecordsInMemory(cfg);
  String path=MPIContext.getShuffleDirectoryPath(cfg);
  finished=new ConcurrentHashMap<>();
  partition=(MPIDataFlowPartition)op;
  keyed=partition.getKeyType() != null;
  for (  Integer target : expectedIds.keySet()) {
    Map<Integer,Boolean> perTarget=new ConcurrentHashMap<>();
    for (    Integer exp : expectedIds.get(target)) {
      perTarget.put(exp,false);
    }
    finished.put(target,perTarget);
    Shuffle sortedMerger;
    if (partition.getKeyType() == null) {
      sortedMerger=new FSMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getDataType());
    }
 else {
      if (sorted) {
        sortedMerger=new FSKeyedSortedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getKeyType(),partition.getDataType(),comparator,target);
      }
 else {
        sortedMerger=new FSKeyedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getKeyType(),partition.getDataType());
      }
    }
    sortedMergers.put(target,sortedMerger);
  }
}

Fixed version (ground truth):
public void init(Config cfg,DataFlowOperation op,Map<Integer,List<Integer>> expectedIds){
  int maxBytesInMemory=MPIContext.getShuffleMaxBytesInMemory(cfg);
  int maxRecordsInMemory=MPIContext.getShuffleMaxRecordsInMemory(cfg);
  String path=MPIContext.getShuffleDirectoryPath(cfg);
  executor=op.getTaskPlan().getThisExecutor();
  finished=new ConcurrentHashMap<>();
  partition=(MPIDataFlowPartition)op;
  keyed=partition.getKeyType() != null;
  for (  Integer target : expectedIds.keySet()) {
    Map<Integer,Boolean> perTarget=new ConcurrentHashMap<>();
    for (    Integer exp : expectedIds.get(target)) {
      perTarget.put(exp,false);
    }
    finished.put(target,perTarget);
    Shuffle sortedMerger;
    if (partition.getKeyType() == null) {
      sortedMerger=new FSMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getDataType());
    }
 else {
      if (sorted) {
        sortedMerger=new FSKeyedSortedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getKeyType(),partition.getDataType(),comparator,target);
      }
 else {
        sortedMerger=new FSKeyedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(target),partition.getKeyType(),partition.getDataType());
      }
    }
    sortedMergers.put(target,sortedMerger);
  }
}
Program: 172959
Project: 172959
Buggy source:
@Override public void onFinish(int target){
  Shuffle sortedMerger=sortedMergers.get(target);
  sortedMerger.switchToReading();
  Iterator<Object> itr=sortedMerger.readIterator();
  batchReceiver.receive(target,itr);
}

Fixed version (ground truth):
@Override public void onFinish(int target){
  Shuffle sortedMerger=sortedMergers.get(target);
  sortedMerger.switchToReading();
  Iterator<Object> itr=sortedMerger.readIterator();
  try {
    batchReceiver.receive(target,itr);
  }
 catch (  RuntimeException e) {
    LOG.log(Level.INFO,"String_Node_Str" + executor + "String_Node_Str"+ target,e);
  }
}
Program: 172960
Project: 172960
Buggy source:
/** 
 * Add the data to the file
 * @param data
 * @param length
 */
public void add(Object key,byte[] data,int length){
  if (status == FSStatus.READING) {
    throw new RuntimeException("String_Node_Str");
  }
  lock.lock();
  try {
    recordsInMemory.add(new KeyValue(convertKeyToArray(key),data,keyComparator));
    bytesLength.add(length);
    numOfBytesInMemory+=length;
    if (numOfBytesInMemory > maxBytesToKeepInMemory || recordsInMemory.size() > maxRecordsInMemory) {
      notFull.signal();
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Add the data to the file
 * @param data
 * @param length
 */
public void add(Object key,byte[] data,int length){
  if (status == FSStatus.READING) {
    throw new RuntimeException("String_Node_Str");
  }
  Object k1=convertKeyToArray(key);
  int[] k=(int[])k1;
  try {
    int i=k[0];
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  LOG.log(Level.INFO,"String_Node_Str" + target + "String_Node_Str"+ recordsInMemory.size());
  lock.lock();
  try {
    recordsInMemory.add(new KeyValue(k1,data,keyComparator));
    bytesLength.add(length);
    numOfBytesInMemory+=length;
    if (numOfBytesInMemory > maxBytesToKeepInMemory || recordsInMemory.size() > maxRecordsInMemory) {
      notFull.signal();
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 172961
Project: 172961
Buggy source:
public void switchToReading(){
  status=FSStatus.READING;
  deserializeObjects();
  Collections.sort(objectsInMemory);
}

Fixed version (ground truth):
public void switchToReading(){
  status=FSStatus.READING;
  for (  KeyValue k1 : objectsInMemory) {
    int[] k=(int[])k1.getKey();
    try {
      int i=k[0];
    }
 catch (    ArrayIndexOutOfBoundsException e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
  Collections.sort(objectsInMemory);
  for (  KeyValue k1 : objectsInMemory) {
    int[] k=(int[])k1.getKey();
    try {
      int i=k[0];
    }
 catch (    ArrayIndexOutOfBoundsException e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}
Program: 172962
Project: 172962
Buggy source:
public void insert(KeyValue data,int listNo){
  if (position == 0) {
    heap[position + 1]=new HeapNode(data,listNo);
    position=2;
  }
 else {
    heap[position++]=new HeapNode(data,listNo);
    bubbleUp();
  }
}

Fixed version (ground truth):
public void insert(KeyValue data,int listNo){
  int[] key=(int[])data.getKey();
  try {
    int i=key[0];
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw e;
  }
  if (position == 0) {
    heap[position + 1]=new HeapNode(data,listNo);
    position=2;
  }
 else {
    heap[position++]=new HeapNode(data,listNo);
    bubbleUp();
  }
}
Program: 172963
Project: 172963
Buggy source:
@Override public boolean send(int src,Object message,int flags,int dest){
  return delegete.sendMessage(src,message,dest,flags,sendRoutingParameters(src,0));
}

Fixed version (ground truth):
@Override public boolean send(int src,Object message,int flags,int dest){
  RoutingParameters routingParameters=sendRoutingParameters(src,0);
  return delegete.sendMessage(src,message,dest,flags,routingParameters);
}
Program: 172964
Project: 172964
Buggy source:
@Override public void onReceiveComplete(int id,int e,MPIBuffer buffer){
  MPIMessage currentMessage=currentMessages.get(id);
  ByteBuffer byteBuffer=buffer.getByteBuffer();
  byteBuffer.position(buffer.getSize());
  byteBuffer.flip();
  receiveCount++;
  if (currentMessage == null) {
    currentMessage=new MPIMessage(id,type,MPIMessageDirection.IN,this);
    if (isKeyed) {
      currentMessage.setKeyType(keyType);
    }
    currentMessages.put(id,currentMessage);
    MessageHeader header=messageDeSerializer.get(id).buildHeader(buffer,e);
    currentMessage.setHeader(header);
    currentMessage.setHeaderSize(16);
  }
  currentMessage.addBuffer(buffer);
  currentMessage.build();
  if (currentMessage.isComplete()) {
    currentMessages.remove(id);
    Queue<MPIMessage> deserializeQueue=pendingReceiveDeSerializations.get(id);
    if (!deserializeQueue.offer(currentMessage)) {
      throw new RuntimeException(executor + "String_Node_Str" + deserializeQueue.size());
    }
  }
}

Fixed version (ground truth):
@Override public void onReceiveComplete(int id,int e,MPIBuffer buffer){
  MPIMessage currentMessage=currentMessages.get(id);
  ByteBuffer byteBuffer=buffer.getByteBuffer();
  byteBuffer.position(buffer.getSize());
  byteBuffer.flip();
  receiveCount++;
  if (currentMessage == null) {
    currentMessage=new MPIMessage(id,type,MPIMessageDirection.IN,this);
    if (isKeyed) {
      currentMessage.setKeyType(keyType);
    }
    currentMessages.put(id,currentMessage);
    MessageHeader header=messageDeSerializer.get(id).buildHeader(buffer,e);
    currentMessage.setHeader(header);
    currentMessage.setHeaderSize(16);
  }
  currentMessage.addBuffer(buffer);
  currentMessage.build();
  if (currentMessage.isComplete()) {
    currentMessages.remove(id);
    LOG.info(String.format("String_Node_Str",executor,id));
    Queue<MPIMessage> deserializeQueue=pendingReceiveDeSerializations.get(id);
    if (!deserializeQueue.offer(currentMessage)) {
      throw new RuntimeException(executor + "String_Node_Str" + deserializeQueue.size());
    }
  }
}
Program: 172966
Project: 172966
Buggy source:
public void execute(){
  while (!inQueue.isEmpty()) {
    IMessage m=inQueue.poll();
    task.execute(m);
  }
}

Fixed version (ground truth):
public void execute(){
  while (!inQueue.isEmpty()) {
    IMessage m=inQueue.poll();
    task.execute(m);
  }
  for (  Map.Entry<String,IParallelOperation> e : inParOps.entrySet()) {
    e.getValue().progress();
  }
}
Program: 172967
Project: 172967
Buggy source:
public void execute(){
  while (!inQueue.isEmpty()) {
    IMessage m=inQueue.poll();
    task.run(m);
    while (!outQueue.isEmpty()) {
      IMessage message=outQueue.poll();
      if (message != null) {
        String edge=message.edge();
        IParallelOperation op=outParOps.get(edge);
        op.send(taskId,message);
      }
    }
  }
  for (  Map.Entry<String,IParallelOperation> e : outParOps.entrySet()) {
    e.getValue().progress();
  }
}

Fixed version (ground truth):
public void execute(){
  while (!inQueue.isEmpty()) {
    IMessage m=inQueue.poll();
    task.run(m);
    while (!outQueue.isEmpty()) {
      IMessage message=outQueue.poll();
      if (message != null) {
        String edge=message.edge();
        IParallelOperation op=outParOps.get(edge);
        op.send(taskId,message);
      }
    }
  }
  for (  Map.Entry<String,IParallelOperation> e : outParOps.entrySet()) {
    e.getValue().progress();
  }
  for (  Map.Entry<String,IParallelOperation> e : inParOps.entrySet()) {
    e.getValue().progress();
  }
}
Program: 172968
Project: 172968
Buggy source:
public void partition(Object message){
}

Fixed version (ground truth):
public void partition(int source,Object message){
  if (!comm.getSources().contains(source)) {
    throw new RuntimeException("String_Node_Str");
  }
  partition.send(source,message,0,MPIContext.DEFAULT_DESTINATION);
}
Program: 172969
Project: 172969
Buggy source:
@Override public void init(Config config,int id,ResourcePlan resourcePlan){
  GeneratorTask g=new GeneratorTask();
  RecevingTask r=new RecevingTask();
  GraphBuilder builder=GraphBuilder.newBuilder();
  builder.addSource("String_Node_Str",g);
  builder.setParallelism("String_Node_Str",4);
  builder.addSink("String_Node_Str",r);
  builder.setParallelism("String_Node_Str",1);
  builder.connect("String_Node_Str","String_Node_Str","String_Node_Str",Operations.REDUCE);
  DataFlowTaskGraph graph=builder.build();
  RoundRobinTaskScheduling roundRobinTaskScheduling=new RoundRobinTaskScheduling();
  roundRobinTaskScheduling.initialize(config);
  WorkerPlan workerPlan=createWorkerPlan(resourcePlan);
  TaskSchedulePlan taskSchedulePlan=roundRobinTaskScheduling.schedule(graph,workerPlan);
  TWSNetwork network=new TWSNetwork(config,resourcePlan.getThisId());
  ExecutionPlanBuilder executionPlanBuilder=new ExecutionPlanBuilder(resourcePlan,network);
  ExecutionPlan plan=executionPlanBuilder.schedule(config,graph,taskSchedulePlan);
  ExecutionModel executionModel=new ExecutionModel(ExecutionModel.SHARED);
  ThreadExecutor executor=new ThreadExecutor(executionModel,plan);
  executor.execute();
  while (true) {
    network.getChannel().progress();
  }
}

Fixed version (ground truth):
@Override public void init(Config cfg,DataFlowOperation op,Map<Integer,List<Integer>> expectedIds,TaskContext context){
}
Program: 172970
Project: 172970
Buggy source:
public static void main(String[] args){
  Config config=ResourceAllocator.loadConfig(new HashMap<>());
  JobConfig jobConfig=new JobConfig();
  BasicJob.BasicJobBuilder jobBuilder=BasicJob.newBuilder();
  jobBuilder.setName("String_Node_Str");
  jobBuilder.setContainerClass(PartitionTask.class.getName());
  jobBuilder.setRequestResource(new ResourceContainer(2,1024),4);
  jobBuilder.setConfig(jobConfig);
  Twister2Submitter.submitContainerJob(jobBuilder.build(),config);
}

Fixed version (ground truth):
public static void main(String[] args){
  Config config=ResourceAllocator.loadConfig(new HashMap<>());
  JobConfig jobConfig=new JobConfig();
  BasicJob.BasicJobBuilder jobBuilder=BasicJob.newBuilder();
  jobBuilder.setName("String_Node_Str");
  jobBuilder.setContainerClass(ReduceTask.class.getName());
  jobBuilder.setRequestResource(new ResourceContainer(2,1024),4);
  jobBuilder.setConfig(jobConfig);
  Twister2Submitter.submitContainerJob(jobBuilder.build(),config);
}
Program: 172971
Project: 172971
Buggy source:
/** 
 * This method saves the data to file system
 */
public void run(){
  List<KeyValue> list;
  lock.lock();
  try {
    list=recordsInMemory;
    recordsInMemory=new ArrayList<>();
  }
  finally {
    lock.unlock();
  }
  if (numOfBytesInMemory > maxBytesToKeepInMemory || recordsInMemory.size() > maxRecordsInMemory) {
    Collections.sort(list);
    int totalSize=FileLoader.saveKeyValues(recordsInMemory,bytesLength,numOfBytesInMemory,getSaveFileName(noOfFileWritten),keyType,kryoSerializer);
    filePartBytes.add(totalSize);
    recordsInMemory.clear();
    bytesLength.clear();
    noOfFileWritten++;
    numOfBytesInMemory=0;
  }
}

Fixed version (ground truth):
/** 
 * This method saves the data to file system
 */
public void run(){
  List<KeyValue> list;
  lock.lock();
  try {
    list=recordsInMemory;
    recordsInMemory=new ArrayList<>();
  }
  finally {
    lock.unlock();
  }
  if (numOfBytesInMemory > maxBytesToKeepInMemory || recordsInMemory.size() > maxRecordsInMemory) {
    Collections.sort(list);
    int totalSize=FileLoader.saveKeyValues(list,bytesLength,numOfBytesInMemory,getSaveFileName(noOfFileWritten),keyType,kryoSerializer);
    filePartBytes.add(totalSize);
    recordsInMemory.clear();
    bytesLength.clear();
    noOfFileWritten++;
    numOfBytesInMemory=0;
  }
}
Program: 172972
Project: 172972
Buggy source:
public static OpenFilePart openPart(String fileName,long startOffSet,int maxSize,MessageType keyType,MessageType dataType,KryoMemorySerializer deserializer){
  List<KeyValue> keyValues=new ArrayList<>();
  String outFileName=Paths.get(fileName).toString();
  FileChannel rwChannel;
  try {
    rwChannel=new RandomAccessFile(outFileName,"String_Node_Str").getChannel();
    long size=maxSize < rwChannel.size() - startOffSet ? maxSize : rwChannel.size() - startOffSet;
    ByteBuffer os=rwChannel.map(FileChannel.MapMode.READ_ONLY,startOffSet,size);
    int totalRead=0;
    while (totalRead < size) {
      Object key;
      Object value;
      int keySize=os.getInt();
      key=deserialize(keyType,deserializer,os,keySize);
      if (totalRead + keySize > size) {
        break;
      }
      int dataSize=os.getInt();
      value=deserialize(dataType,deserializer,os,dataSize);
      if (totalRead + keySize + dataSize > size) {
        break;
      }
      keyValues.add(new KeyValue(key,value));
      totalRead+=8 + keySize + dataSize;
    }
    rwChannel.close();
    return new OpenFilePart(keyValues,totalRead + (int)startOffSet,(int)rwChannel.size(),fileName);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Reads a file part upto max size from start offset
 * @param fileName
 * @param startOffSet
 * @param maxSize
 * @param keyType
 * @param dataType
 * @param deserializer
 * @return
 */
public static OpenFilePart openPart(String fileName,long startOffSet,int maxSize,MessageType keyType,MessageType dataType,KryoMemorySerializer deserializer){
  List<KeyValue> keyValues=new ArrayList<>();
  String outFileName=Paths.get(fileName).toString();
  FileChannel rwChannel;
  try {
    rwChannel=new RandomAccessFile(outFileName,"String_Node_Str").getChannel();
    long size=maxSize <= rwChannel.size() - startOffSet ? maxSize : rwChannel.size() - startOffSet;
    ByteBuffer os=rwChannel.map(FileChannel.MapMode.READ_ONLY,startOffSet,size);
    int totalRead=0;
    int count=0;
    while (totalRead < size) {
      Object key;
      Object value;
      int keySize=os.getInt();
      key=deserialize(keyType,deserializer,os,keySize);
      if (totalRead + keySize > size) {
        break;
      }
      int dataSize=os.getInt();
      value=deserialize(dataType,deserializer,os,dataSize);
      if (totalRead + keySize + dataSize > size) {
        break;
      }
      LOG.log(Level.INFO,"String_Node_Str" + dataSize + "String_Node_Str"+ count+ "String_Node_Str"+ fileName+ "String_Node_Str"+ totalRead+ "String_Node_Str"+ value);
      keyValues.add(new KeyValue(key,value));
      totalRead+=8 + keySize + dataSize;
      count++;
    }
    rwChannel.close();
    return new OpenFilePart(keyValues,totalRead + (int)startOffSet,(int)rwChannel.size(),fileName);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 172973
Project: 172973
Buggy source:
public static void main(ExecutionModel[] args){
  Config config=ResourceAllocator.loadConfig(new HashMap<>());
  JobConfig jobConfig=new JobConfig();
  BasicJob.BasicJobBuilder jobBuilder=BasicJob.newBuilder();
  jobBuilder.setName("String_Node_Str");
  jobBuilder.setContainerClass(PartitionTask.class.getName());
  jobBuilder.setRequestResource(new ResourceContainer(2,1024),4);
  jobBuilder.setConfig(jobConfig);
  Twister2Submitter.submitContainerJob(jobBuilder.build(),config);
}

Fixed version (ground truth):
public static void main(String[] args){
  Config config=ResourceAllocator.loadConfig(new HashMap<>());
  JobConfig jobConfig=new JobConfig();
  BasicJob.BasicJobBuilder jobBuilder=BasicJob.newBuilder();
  jobBuilder.setName("String_Node_Str");
  jobBuilder.setContainerClass(PartitionTask.class.getName());
  jobBuilder.setRequestResource(new ResourceContainer(2,1024),4);
  jobBuilder.setConfig(jobConfig);
  Twister2Submitter.submitContainerJob(jobBuilder.build(),config);
}
Program: 172974
Project: 172974
Buggy source:
@Override public KeyValue next(){
  HeapNode node=heap.extractMin();
  numValuesInHeap--;
  OpenFilePart part=openFiles.get(node.listNo);
  if (!part.hasNext()) {
    if (part.getFileSize() <= part.getReadOffSet()) {
      openFiles.remove(node.listNo);
    }
 else {
      OpenFilePart newPart=FileLoader.openPart(getSaveFileName(node.listNo),part.getReadOffSet(),maxMemoryPerFile,keyType,dataType,kryoSerializer);
      openFiles.put(node.listNo,newPart);
      if (newPart.hasNext()) {
        heap.insert(newPart.next(),node.listNo);
        numValuesInHeap++;
      }
    }
  }
 else {
    heap.insert(part.next(),node.listNo);
    numValuesInHeap++;
  }
  return node.data;
}

Fixed version (ground truth):
@Override public KeyValue next(){
  HeapNode node=heap.extractMin();
  numValuesInHeap--;
  OpenFilePart part=openFiles.get(node.listNo);
  if (!part.hasNext()) {
    if (part.getFileSize() <= part.getReadOffSet()) {
      openFiles.remove(node.listNo);
    }
 else {
      OpenFilePart newPart=FileLoader.openPart(getSaveFileName(node.listNo),part.getReadOffSet(),maxMemoryPerFile,keyType,dataType,kryoSerializer);
      openFiles.put(node.listNo,newPart);
      if (newPart.hasNext()) {
        KeyValue next=newPart.next();
        heap.insert(next,node.listNo);
        numValuesInHeap++;
      }
    }
  }
 else {
    heap.insert(part.next(),node.listNo);
    numValuesInHeap++;
  }
  return node.data;
}
Program: 172975
Project: 172975
Buggy source:
@Override public boolean onMessage(int source,int destination,int target,int flags,Object object){
  LOG.info("String_Node_Str");
  TaskMessage msg=new TaskMessage(object,edge.getStringMapping(communicationEdge),target);
  LOG.info("String_Node_Str" + source + "String_Node_Str"+ msg.getContent()+ "String_Node_Str"+ target+ "String_Node_Str"+ destination);
  if (object instanceof List) {
    for (    Object o : (List)object) {
      outMessages.get(target).offer(msg);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onMessage(int source,int destination,int target,int flags,Object object){
  if (object instanceof List) {
    for (    Object o : (List)object) {
      TaskMessage msg=new TaskMessage(o,edge.getStringMapping(communicationEdge),target);
      outMessages.get(target).offer(msg);
      LOG.info("String_Node_Str" + source + "String_Node_Str"+ msg.getContent()+ "String_Node_Str"+ target+ "String_Node_Str"+ destination);
    }
  }
  return true;
}
Program: 172978
Project: 172978
Buggy source:
public void prepare(int srcs,Set<Integer> dests,EdgeGenerator e,DataType dataType,String edgeName){
  this.edge=e;
  op=new MPIDataFlowBroadcast(channel,srcs,dests,new BcastReceiver());
  communicationEdge=e.generate(edgeName);
  op.init(config,Utils.dataTypeToMessageType(dataType),taskPlan,communicationEdge);
}

Fixed version (ground truth):
public void prepare(int srcs,Set<Integer> dests,EdgeGenerator e,DataType dataType,String edgeName){
  this.edge=e;
  LOG.info(String.format("String_Node_Str",srcs,dests));
  op=new MPIDataFlowBroadcast(channel,srcs,dests,new BcastReceiver());
  communicationEdge=e.generate(edgeName);
  op.init(config,Utils.dataTypeToMessageType(dataType),taskPlan,communicationEdge);
}
Program: 172979
Project: 172979
Buggy source:
boolean receiveMessage(int rank,int stream,MPIMessageListener callback,Queue<MPIBuffer> receiveBuffers);

Fixed version (ground truth):
/** 
 * Receive a message
 * @param id worker id
 * @param edge the graph edge to receive from
 * @param callback callback for message completions
 * @param receiveBuffers the list of receive buffers
 * @return true if sending is accepted
 */
boolean receiveMessage(int id,int edge,MPIMessageListener callback,Queue<MPIBuffer> receiveBuffers);
Program: 172980
Project: 172980
Buggy source:
boolean sendMessage(int id,MPIMessage message,MPIMessageListener callback);

Fixed version (ground truth):
/** 
 * Send a message
 * @param id worker id
 * @param message message
 * @param callback callback for message completions
 * @return true if sending is accepted
 */
boolean sendMessage(int id,MPIMessage message,MPIMessageListener callback);
Program: 172981
Project: 172981
Buggy source:
void progress();

Fixed version (ground truth):
/** 
 * Progress the channel
 */
void progress();
Program: 172982
Project: 172982
Buggy source:
ByteBuffer createBuffer(int capacity);

Fixed version (ground truth):
/** 
 * Create a buffer
 * @param capacity capacity
 * @return the byte buffer
 */
ByteBuffer createBuffer(int capacity);
Program: 172983
Project: 172983
Buggy source:
public KeyedContent(Object source,Object object,MessageType keyType,MessageType contentType){
  this.source=source;
  this.object=object;
  this.keyType=keyType;
  this.contentType=contentType;
}

Fixed version (ground truth):
public KeyedContent(Object source,Object object,MessageType keyType,MessageType contentType){
  this.key=source;
  this.value=object;
  this.keyType=keyType;
  this.contentType=contentType;
}
Program: 172984
Project: 172984
Buggy source:
/** 
 * Serialized the message into the buffer
 * @return true if the message is completely written
 */
private boolean serializeBody(Object payload,MPISendMessage sendMessage,MPIBuffer buffer){
  MessageType type=sendMessage.getMPIMessage().getType();
  if (type == MessageType.OBJECT || type == MessageType.INTEGER || type == MessageType.LONG || type == MessageType.DOUBLE || type == MessageType.BYTE || type == MessageType.STRING || type == MessageType.MULTI_FIXED_BYTE) {
    if (!keyed) {
      return serializeData(payload,sendMessage.getSerializationState(),buffer,type);
    }
 else {
      KeyedContent keyedContent=(KeyedContent)payload;
      return serializeKeyedData(keyedContent.getObject(),keyedContent.getSource(),sendMessage.getSerializationState(),buffer,type,keyedContent.getKeyType());
    }
  }
  if (type == MessageType.BUFFER) {
    return serializeBuffer(payload,sendMessage,buffer);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Serialized the message into the buffer
 * @return true if the message is completely written
 */
private boolean serializeBody(Object payload,MPISendMessage sendMessage,MPIBuffer buffer){
  MessageType type=sendMessage.getMPIMessage().getType();
  if (type == MessageType.OBJECT || type == MessageType.INTEGER || type == MessageType.LONG || type == MessageType.DOUBLE || type == MessageType.BYTE || type == MessageType.STRING || type == MessageType.MULTI_FIXED_BYTE) {
    if (!keyed) {
      return serializeData(payload,sendMessage.getSerializationState(),buffer,type);
    }
 else {
      KeyedContent keyedContent=(KeyedContent)payload;
      return serializeKeyedData(keyedContent.getValue(),keyedContent.getKey(),sendMessage.getSerializationState(),buffer,type,keyedContent.getKeyType());
    }
  }
  if (type == MessageType.BUFFER) {
    return serializeBuffer(payload,sendMessage,buffer);
  }
  return false;
}
Program: 172985
Project: 172985
Buggy source:
/** 
 * Serialized the message into the buffer
 * @return true if the message is completely written
 */
private boolean serializeMessage(Object payload,MPISendMessage sendMessage,MPIBuffer buffer){
  MessageType type=sendMessage.getMPIMessage().getType();
  if (!keyed) {
    return serializeData(payload,sendMessage.getSerializationState(),buffer,type);
  }
 else {
    KeyedContent kc=(KeyedContent)payload;
    return serializeKeyedData(kc.getObject(),kc.getSource(),sendMessage.getSerializationState(),buffer,kc.getContentType(),kc.getKeyType());
  }
}

Fixed version (ground truth):
/** 
 * Serialized the message into the buffer
 * @return true if the message is completely written
 */
private boolean serializeMessage(Object payload,MPISendMessage sendMessage,MPIBuffer buffer){
  MessageType type=sendMessage.getMPIMessage().getType();
  if (!keyed) {
    return serializeData(payload,sendMessage.getSerializationState(),buffer,type);
  }
 else {
    KeyedContent kc=(KeyedContent)payload;
    return serializeKeyedData(kc.getValue(),kc.getKey(),sendMessage.getSerializationState(),buffer,kc.getContentType(),kc.getKeyType());
  }
}
Program: 172986
Project: 172986
Buggy source:
private void deserialize(MPIMessage message){
  List<MPIBuffer> buffers=message.getBuffers();
  for (  MPIBuffer mpiBuffer : buffers) {
    mpiBuffer.getByteBuffer().flip();
    mpiBuffer.getByteBuffer().rewind();
  }
  if (message.isComplete()) {
    System.out.printf("String_Node_Str");
  }
  message.setKeyType(MessageType.SHORT);
  MessageHeader header=mpiMultiMessageDeserializer.buildHeader(message.getBuffers().get(0),0);
  message.setHeader(header);
  System.out.println(String.format("String_Node_Str",header.getLength(),header.getSourceId(),header.getEdge()));
  Object d=mpiMultiMessageDeserializer.build(message,0);
  List list=(List)d;
  for (  Object o : list) {
    if (o instanceof KeyedContent) {
      System.out.println(((KeyedContent)o).getSource());
      if (((KeyedContent)o).getObject() instanceof IntData) {
        System.out.println("String_Node_Str" + ((IntData)((KeyedContent)o).getObject()).getData().length);
      }
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
private void deserialize(MPIMessage message){
  List<MPIBuffer> buffers=message.getBuffers();
  for (  MPIBuffer mpiBuffer : buffers) {
    mpiBuffer.getByteBuffer().flip();
    mpiBuffer.getByteBuffer().rewind();
  }
  if (message.isComplete()) {
    System.out.printf("String_Node_Str");
  }
  message.setKeyType(MessageType.SHORT);
  MessageHeader header=mpiMultiMessageDeserializer.buildHeader(message.getBuffers().get(0),0);
  message.setHeader(header);
  System.out.println(String.format("String_Node_Str",header.getLength(),header.getSourceId(),header.getEdge()));
  Object d=mpiMultiMessageDeserializer.build(message,0);
  List list=(List)d;
  for (  Object o : list) {
    if (o instanceof KeyedContent) {
      System.out.println(((KeyedContent)o).getKey());
      if (((KeyedContent)o).getValue() instanceof IntData) {
        System.out.println("String_Node_Str" + ((IntData)((KeyedContent)o).getValue()).getData().length);
      }
    }
  }
  System.out.println("String_Node_Str");
}
Program: 172987
Project: 172987
Buggy source:
public void init(Config cfg,DataFlowOperation op,Map<Integer,List<Integer>> expectedIds){
  int maxBytesInMemory=MPIContext.getShuffleMaxBytesInMemory(cfg);
  int maxRecordsInMemory=MPIContext.getShuffleMaxRecordsInMemory(cfg);
  String path=MPIContext.getShuffleDirectoryPath(cfg);
  finished=new ConcurrentHashMap<>();
  for (  Integer integer : expectedIds.keySet()) {
    Map<Integer,Boolean> perTarget=new ConcurrentHashMap<>();
    Map<Integer,List<Object>> d=new ConcurrentHashMap<>();
    for (    Integer exp : expectedIds.get(integer)) {
      perTarget.put(exp,false);
      d.put(exp,new ArrayList<>());
    }
    finished.put(integer,perTarget);
  }
  partition=(MPIDataFlowPartition)op;
  if (partition.getKeyType() == null) {
    merger=new FSMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(),partition.getDataType());
  }
 else {
    if (sorted) {
      sortedMerger=new FSKeyedSortedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(),partition.getKeyType(),partition.getDataType(),comparator);
    }
 else {
      keyedMerger=new FSKeyedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(),partition.getKeyType(),partition.getDataType());
    }
  }
}

Fixed version (ground truth):
public void init(Config cfg,DataFlowOperation op,Map<Integer,List<Integer>> expectedIds){
  int maxBytesInMemory=MPIContext.getShuffleMaxBytesInMemory(cfg);
  int maxRecordsInMemory=MPIContext.getShuffleMaxRecordsInMemory(cfg);
  String path=MPIContext.getShuffleDirectoryPath(cfg);
  finished=new ConcurrentHashMap<>();
  for (  Integer integer : expectedIds.keySet()) {
    Map<Integer,Boolean> perTarget=new ConcurrentHashMap<>();
    Map<Integer,List<Object>> d=new ConcurrentHashMap<>();
    for (    Integer exp : expectedIds.get(integer)) {
      perTarget.put(exp,false);
      d.put(exp,new ArrayList<>());
    }
    finished.put(integer,perTarget);
  }
  partition=(MPIDataFlowPartition)op;
  if (partition.getKeyType() == null) {
    sortedMerger=new FSMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(),partition.getDataType());
  }
 else {
    if (sorted) {
      sortedMerger=new FSKeyedSortedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(),partition.getKeyType(),partition.getDataType(),comparator);
    }
 else {
      sortedMerger=new FSKeyedMerger(maxBytesInMemory,maxRecordsInMemory,path,getOperationName(),partition.getKeyType(),partition.getDataType());
    }
  }
  keyed=partition.getKeyType() != null;
}