nus-yam/ex-repair huggingface dataset:
Program: 88016
Project: 88016
Buggy source:
@Override public char charAt(int index){
  return this.value[index];
}

Fixed version (ground truth):
@Override public char charAt(int index){
  if (index < len) {
    return this.value[index];
  }
 else {
    throw new IndexOutOfBoundsException();
  }
}
Program: 88017
Project: 88017
Buggy source:
@Test public void testPactNull(){
  final PactNull pn1=new PactNull();
  final PactNull pn2=new PactNull();
  assertNormalizableKey(pn1,pn2,0);
  final PactNull pn=new PactNull();
  try {
    pn.write(mOut);
    pn.read(mIn);
    assertNormalizableKey(pn,pn1,0);
  }
 catch (  IOException ioex) {
    Assert.fail("String_Node_Str" + ioex.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testPactNull(){
  final PactNull pn1=new PactNull();
  final PactNull pn2=new PactNull();
  assertNormalizableKey(pn1,pn2,0);
}
Program: 88018
Project: 88018
Buggy source:
@Test public void testPactString(){
  PactString string0=new PactString("String_Node_Str");
  PactString string1=new PactString("String_Node_Str");
  PactString string2=new PactString("String_Node_Str");
  PactString string3=new PactString("String_Node_Str");
  PactString string4=new PactString("String_Node_Str");
  for (int length=5; length <= 15; length+=10) {
    assertNormalizableKey(string0,string1,length);
    assertNormalizableKey(string0,string2,length);
    assertNormalizableKey(string0,string3,length);
    assertNormalizableKey(string0,string4,length);
  }
  try {
    string0.write(mOut);
    string4.write(mOut);
    string2.write(mOut);
    string3.write(mOut);
    PactString string1n=new PactString();
    PactString string2n=new PactString();
    PactString string3n=new PactString();
    PactString string4n=new PactString();
    string1n.read(mIn);
    string4n.read(mIn);
    string2n.read(mIn);
    string3n.read(mIn);
    for (int length=5; length <= 15; length+=10) {
      assertNormalizableKey(string0,string1n,length);
      assertNormalizableKey(string0,string2n,length);
      assertNormalizableKey(string0,string3n,length);
      assertNormalizableKey(string0,string4n,length);
    }
    string2.setValue("String_Node_Str");
    assertNormalizableKey(string2,string3,32);
  }
 catch (  Exception e) {
    Assert.assertTrue(false);
  }
}

Fixed version (ground truth):
@Test public void testPactString(){
  PactString string0=new PactString("String_Node_Str");
  PactString string1=new PactString("String_Node_Str");
  PactString string2=new PactString("String_Node_Str");
  PactString string3=new PactString("String_Node_Str");
  PactString string4=new PactString("String_Node_Str");
  for (int length=5; length <= 15; length+=10) {
    assertNormalizableKey(string0,string1,length);
    assertNormalizableKey(string0,string2,length);
    assertNormalizableKey(string0,string3,length);
    assertNormalizableKey(string0,string4,length);
  }
}
Program: 88019
Project: 88019
Buggy source:
@Test public void testPactInteger(){
  PactInteger int0=new PactInteger(10);
  Assert.assertEquals(10,int0.getValue());
  PactInteger int1=new PactInteger(10);
  PactInteger int2=new PactInteger(-10);
  PactInteger int3=new PactInteger(255);
  for (int length=2; length <= 4; length++) {
    assertNormalizableKey(int0,int1,length);
    assertNormalizableKey(int0,int2,length);
    assertNormalizableKey(int0,int3,length);
  }
  try {
    int0.write(mOut);
    int2.write(mOut);
    int3.write(mOut);
    PactInteger int1n=new PactInteger();
    PactInteger int2n=new PactInteger();
    PactInteger int3n=new PactInteger();
    int1n.read(mIn);
    int2n.read(mIn);
    int3n.read(mIn);
    for (int length=2; length <= 4; length++) {
      assertNormalizableKey(int0,int1n,length);
      assertNormalizableKey(int0,int2n,length);
      assertNormalizableKey(int0,int3n,length);
    }
  }
 catch (  Exception e) {
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testPactInteger(){
  PactInteger int0=new PactInteger(10);
  PactInteger int1=new PactInteger(10);
  PactInteger int2=new PactInteger(-10);
  PactInteger int3=new PactInteger(255);
  PactInteger int4=new PactInteger(Integer.MAX_VALUE);
  PactInteger int5=new PactInteger(Integer.MAX_VALUE & 0xff800000);
  PactInteger int6=new PactInteger(Integer.MIN_VALUE);
  PactInteger int7=new PactInteger(Integer.MIN_VALUE & 0xff800000);
  for (int length=2; length <= 4; length++) {
    assertNormalizableKey(int0,int1,length);
    assertNormalizableKey(int0,int2,length);
    assertNormalizableKey(int0,int3,length);
    assertNormalizableKey(int0,int4,length);
    assertNormalizableKey(int0,int5,length);
    assertNormalizableKey(int0,int6,length);
    assertNormalizableKey(int0,int7,length);
    assertNormalizableKey(int4,int5,length);
    assertNormalizableKey(int6,int7,length);
  }
}
Program: 88020
Project: 88020
Buggy source:
@Test public void testPactLong(){
  PactLong long0=new PactLong(10);
  Assert.assertEquals(10,long0.getValue());
  PactLong long1=new PactLong(10);
  PactLong long2=new PactLong(-10);
  PactLong long3=new PactLong(255);
  for (int length=2; length <= 8; length++) {
    assertNormalizableKey(long0,long1,length);
    assertNormalizableKey(long0,long2,length);
    assertNormalizableKey(long0,long3,length);
  }
  try {
    long0.write(mOut);
    long2.write(mOut);
    long3.write(mOut);
    PactLong long1n=new PactLong();
    PactLong long2n=new PactLong();
    PactLong long3n=new PactLong();
    long1n.read(mIn);
    long2n.read(mIn);
    long3n.read(mIn);
    for (int length=2; length <= 8; length++) {
      assertNormalizableKey(long0,long1n,length);
      assertNormalizableKey(long0,long2n,length);
      assertNormalizableKey(long0,long3n,length);
    }
  }
 catch (  Exception e) {
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testPactLong(){
  PactLong long0=new PactLong(10);
  PactLong long1=new PactLong(10);
  PactLong long2=new PactLong(-10);
  PactLong long3=new PactLong(255);
  PactLong long4=new PactLong(Long.MAX_VALUE);
  PactLong long5=new PactLong(Long.MAX_VALUE & 0xff80000000000000L);
  PactLong long6=new PactLong(Long.MIN_VALUE);
  PactLong long7=new PactLong(Long.MIN_VALUE & 0xff80000000000000L);
  for (int length=2; length <= 8; length++) {
    assertNormalizableKey(long0,long1,length);
    assertNormalizableKey(long0,long2,length);
    assertNormalizableKey(long0,long3,length);
    assertNormalizableKey(long0,long4,length);
    assertNormalizableKey(long0,long5,length);
    assertNormalizableKey(long0,long6,length);
    assertNormalizableKey(long0,long7,length);
    assertNormalizableKey(long4,long5,length);
    assertNormalizableKey(long6,long7,length);
  }
}
Program: 88021
Project: 88021
Buggy source:
private void assertNormalizableKey(Key key1,Key key2,int len){
  byte[] normalizedKeys=new byte[2 * len];
  ((NormalizableKey)key1).copyNormalizedKey(normalizedKeys,0,len);
  ((NormalizableKey)key2).copyNormalizedKey(normalizedKeys,len,len);
  for (int i=0; i < len; i++) {
    int comp;
    if ((comp=(normalizedKeys[i] - normalizedKeys[len + i])) != 0) {
      if (Math.signum(key1.compareTo(key2)) != Math.signum(comp)) {
        Assert.fail("String_Node_Str");
      }
      return;
    }
  }
  if (key1.compareTo(key2) != 0 && ((NormalizableKey)key1).getMaxNormalizedKeyLen() <= len) {
    Assert.fail("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void assertNormalizableKey(NormalizableKey key1,NormalizableKey key2,int len){
  byte[] normalizedKeys=new byte[2 * len];
  key1.copyNormalizedKey(normalizedKeys,0,len);
  key2.copyNormalizedKey(normalizedKeys,len,len);
  for (int i=0; i < len; i++) {
    int comp;
    int normKey1=normalizedKeys[i] & 0xFF;
    int normKey2=normalizedKeys[len + i] & 0xFF;
    if ((comp=(normKey1 - normKey2)) != 0) {
      if (Math.signum(key1.compareTo(key2)) != Math.signum(comp)) {
        Assert.fail("String_Node_Str");
      }
      return;
    }
  }
  if (key1.compareTo(key2) != 0 && key1.getMaxNormalizedKeyLen() <= len) {
    Assert.fail("String_Node_Str" + "String_Node_Str");
  }
}
Program: 88022
Project: 88022
Buggy source:
/** 
 * Deserializes the next record from one of the data buffers.
 * @return the next record or <code>null</code> if all data buffers are exhausted
 * @throws ExecutionFailureException if the record cannot be deserialized
 */
private T deserializeNextRecord(final T target) throws IOException {
  if (this.bufferedRecord != null) {
    final T record=this.bufferedRecord;
    this.bufferedRecord=null;
    return record;
  }
  if (this.uncompressedDataBuffer == null) {
synchronized (this.synchronisationObject) {
      if (this.ioException != null) {
        throw this.ioException;
      }
      requestReadBuffersFromBroker();
    }
    if (this.uncompressedDataBuffer == null) {
      return null;
    }
    if (this.decompressor != null) {
      this.decompressor.decompress();
    }
  }
  final T nextRecord=this.deserializationBuffer.readData(target,this.uncompressedDataBuffer);
  if (this.uncompressedDataBuffer.remaining() == 0) {
    releasedConsumedReadBuffer();
    this.bufferedRecord=nextRecord;
    return null;
  }
  return nextRecord;
}

Fixed version (ground truth):
/** 
 * Deserializes the next record from one of the data buffers.
 * @return the next record or <code>null</code> if all data buffers are exhausted
 * @throws ExecutionFailureException if the record cannot be deserialized
 */
private T deserializeNextRecord(final T target) throws IOException {
  if (this.uncompressedDataBuffer == null) {
synchronized (this.synchronisationObject) {
      if (this.ioException != null) {
        throw this.ioException;
      }
      requestReadBuffersFromBroker();
    }
    if (this.uncompressedDataBuffer == null) {
      return null;
    }
    if (this.decompressor != null) {
      this.decompressor.decompress();
    }
  }
  final T nextRecord=this.deserializationBuffer.readData(target,this.uncompressedDataBuffer);
  if (this.uncompressedDataBuffer.remaining() == 0) {
    releasedConsumedReadBuffer();
  }
  return nextRecord;
}
Program: 88023
Project: 88023
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean isClosed() throws IOException {
  if (this.bufferedRecord != null || this.uncompressedDataBuffer != null) {
    return false;
  }
synchronized (this.synchronisationObject) {
    if (this.ioException != null) {
      throw this.ioException;
    }
    if (!this.brokerAggreedToCloseChannel) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean isClosed() throws IOException {
  if (this.uncompressedDataBuffer != null) {
    return false;
  }
synchronized (this.synchronisationObject) {
    if (this.ioException != null) {
      throw this.ioException;
    }
    if (!this.brokerAggreedToCloseChannel) {
      return false;
    }
  }
  return true;
}
Program: 88024
Project: 88024
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void close() throws IOException, InterruptedException {
  this.deserializationBuffer.clear();
  if (this.uncompressedDataBuffer != null) {
    releasedConsumedReadBuffer();
  }
  if (this.getType() == ChannelType.NETWORK) {
synchronized (this.synchronisationObject) {
      if (!this.brokerAggreedToCloseChannel) {
        while (!this.brokerAggreedToCloseChannel) {
          requestReadBuffersFromBroker();
          if (this.uncompressedDataBuffer != null || this.compressedDataBuffer != null) {
            releasedConsumedReadBuffer();
          }
          this.synchronisationObject.wait(500);
        }
        this.bufferedRecord=null;
      }
    }
  }
  final ChannelType type=getType();
  if (type == ChannelType.NETWORK || type == ChannelType.INMEMORY) {
    transferEvent(new ByteBufferedChannelCloseEvent());
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void close() throws IOException, InterruptedException {
  this.deserializationBuffer.clear();
  if (this.uncompressedDataBuffer != null) {
    releasedConsumedReadBuffer();
  }
  if (this.getType() == ChannelType.NETWORK) {
synchronized (this.synchronisationObject) {
      if (!this.brokerAggreedToCloseChannel) {
        while (!this.brokerAggreedToCloseChannel) {
          requestReadBuffersFromBroker();
          if (this.uncompressedDataBuffer != null || this.compressedDataBuffer != null) {
            releasedConsumedReadBuffer();
          }
          this.synchronisationObject.wait(500);
        }
      }
    }
  }
  final ChannelType type=getType();
  if (type == ChannelType.NETWORK || type == ChannelType.INMEMORY) {
    transferEvent(new ByteBufferedChannelCloseEvent());
  }
}
Program: 88025
Project: 88025
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void queueTransferEnvelope(final TransferEnvelope transferEnvelope){
  final int sequenceNumber=transferEnvelope.getSequenceNumber();
synchronized (this.queuedEnvelopes) {
    if (sequenceNumber <= this.lastReceivedEnvelope) {
      final Buffer buffer=transferEnvelope.getBuffer();
      if (buffer != null) {
        buffer.recycleBuffer();
      }
      return;
    }
    this.queuedEnvelopes.add(transferEnvelope);
    this.lastReceivedEnvelope=sequenceNumber;
  }
  this.byteBufferedInputChannel.checkForNetworkEvents();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void queueTransferEnvelope(final TransferEnvelope transferEnvelope){
  final int sequenceNumber=transferEnvelope.getSequenceNumber();
synchronized (this.queuedEnvelopes) {
    if (sequenceNumber != (this.lastReceivedEnvelope + 1)) {
      final Buffer buffer=transferEnvelope.getBuffer();
      if (buffer != null) {
        buffer.recycleBuffer();
      }
      return;
    }
    this.queuedEnvelopes.add(transferEnvelope);
    this.lastReceivedEnvelope=sequenceNumber;
  }
  this.byteBufferedInputChannel.checkForNetworkEvents();
}
Program: 88026
Project: 88026
Buggy source:
public void restartExecution(){
  this.restarting=true;
  changeExecutionState(ExecutionState.RESTARTING,null);
  LOG.info("String_Node_Str" + this.taskName);
  this.isCanceled=true;
  if (this.executingThread == null) {
    LOG.error("String_Node_Str" + this.taskName + "String_Node_Str");
    return;
  }
  try {
    this.invokable.cancel();
  }
 catch (  Exception e) {
    LOG.error(StringUtils.stringifyException(e));
  }
  while (this.isCanceled) {
    this.executingThread.interrupt();
  }
  LOG.info("String_Node_Str");
  this.isCanceled=false;
  this.executingThread=new Thread(this,this.taskName);
  this.executingThread.start();
  return;
}

Fixed version (ground truth):
public void restartExecution(){
  this.restarting=true;
  changeExecutionState(ExecutionState.RESTARTING,null);
  LOG.info("String_Node_Str" + this.taskName);
  this.isCanceled=true;
  if (this.executingThread == null) {
    LOG.error("String_Node_Str" + this.taskName + "String_Node_Str");
    return;
  }
  try {
    this.invokable.cancel();
  }
 catch (  Exception e) {
    LOG.error(StringUtils.stringifyException(e));
  }
  while (this.isCanceled) {
    this.executingThread.interrupt();
  }
  LOG.info("String_Node_Str");
  System.out.println("String_Node_Str");
  this.isCanceled=false;
  this.executingThread=new Thread(this,this.taskName);
  this.executingThread.start();
  return;
}
Program: 88030
Project: 88030
Buggy source:
/** 
 * Returns the number of successors, i.e. the number of vertices this vertex is connected to.
 * @return the number of successors
 */
public synchronized int getNumberOfSuccessors(){
  int numberOfSuccessors=0;
  LOG.info(this.environment.getNumberOfOutputGates());
  for (int i=0; i < this.environment.getNumberOfOutputGates(); i++) {
    LOG.info(this.environment.getOutputGate(i).getNumberOfOutputChannels());
    numberOfSuccessors+=this.environment.getOutputGate(i).getNumberOfOutputChannels();
  }
  return numberOfSuccessors;
}

Fixed version (ground truth):
/** 
 * Returns the number of successors, i.e. the number of vertices this vertex is connected to.
 * @return the number of successors
 */
public synchronized int getNumberOfSuccessors(){
  int numberOfSuccessors=0;
  for (int i=0; i < this.environment.getNumberOfOutputGates(); i++) {
    numberOfSuccessors+=this.environment.getOutputGate(i).getNumberOfOutputChannels();
  }
  return numberOfSuccessors;
}
Program: 88031
Project: 88031
Buggy source:
/** 
 */
public void recover(ChannelID sourceChannelID){
  try {
    getTaskManager().recover(sourceChannelID);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * recovers the given channel
 */
public void recover(ChannelID sourceChannelID){
  try {
    getTaskManager().recover(sourceChannelID);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 88032
Project: 88032
Buggy source:
@Override public void rewind(){
  this.byteBuffer.rewind();
}

Fixed version (ground truth):
@Override public void rewind(){
  this.byteBuffer.position(0);
}
Program: 88033
Project: 88033
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void vertexAssignmentChanged(ExecutionVertexID id,AllocatedResource newAllocatedResource){
  final ManagementVertexID managementVertexID=id.toManagementVertexID();
  final long timestamp=System.currentTimeMillis();
  final AbstractInstance instance=newAllocatedResource.getInstance();
  VertexAssignmentEvent event;
  if (instance == null) {
    event=new VertexAssignmentEvent(timestamp,managementVertexID,"String_Node_Str","String_Node_Str");
  }
 else {
    event=new VertexAssignmentEvent(timestamp,managementVertexID,instance.getName(),instance.getType().getIdentifier());
  }
  this.eventCollector.updateManagementGraph(jobID,event);
  this.eventCollector.addEvent(this.jobID,event);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void vertexAssignmentChanged(ExecutionVertexID id,AllocatedResource newAllocatedResource){
  final ManagementVertexID managementVertexID=id.toManagementVertexID();
  final long timestamp=System.currentTimeMillis();
  final AbstractInstance instance=newAllocatedResource.getInstance();
  VertexAssignmentEvent event;
  if (instance == null) {
    event=new VertexAssignmentEvent(timestamp,managementVertexID,"String_Node_Str","String_Node_Str");
  }
 else {
    event=new VertexAssignmentEvent(timestamp,managementVertexID,instance.getName(),instance.getType().getIdentifier());
  }
  this.eventCollector.updateManagementGraph(this.jobID,event);
  this.eventCollector.addEvent(this.jobID,event);
}
Program: 88036
Project: 88036
Buggy source:
/** 
 */
void recoverAll(ChannelID sourceChannelID);

Fixed version (ground truth):
/** 
 * @param sourceChannelID
 * @param address
 */
void recoverAll(ChannelID sourceChannelID);
Program: 88037
Project: 88037
Buggy source:
/** 
 */
void recover(ChannelID sourceChannelID);

Fixed version (ground truth):
/** 
 * @param sourceChannelID
 * @param instanceConnectionInfo
 */
void recover(ChannelID sourceChannelID);
Program: 88038
Project: 88038
Buggy source:
public void recoverAll(ChannelID sourceChannelID){
  this.checkpointManager.recoverAllChannelCheckpoints(sourceChannelID);
}

Fixed version (ground truth):
@Override public void recoverAll(ChannelID sourceChannelID){
  this.checkpointManager.recoverAllChannelCheckpoints(sourceChannelID);
}
Program: 88039
Project: 88039
Buggy source:
@Override public void restart(ExecutionVertexID executionVertexID,Configuration jobConfiguration){
  Environment ee=this.runningTasks.remove(executionVertexID);
  ee.restartExecution();
  for (int i=0; i < ee.getNumberOfInputGates(); i++) {
    InputGate<? extends Record> ingate=ee.getInputGate(i);
    for (int j=0; j < ingate.getNumberOfInputChannels(); j++) {
      this.byteBufferedChannelManager.clear(ingate.getInputChannel(j).getID());
    }
  }
  for (int i=0; i < ee.getNumberOfOutputGates(); i++) {
    OutputGate<? extends Record> outgate=ee.getOutputGate(i);
    for (int j=0; j < outgate.getNumberOfOutputChannels(); j++) {
      this.byteBufferedChannelManager.clear(outgate.getOutputChannel(j).getID());
    }
  }
}

Fixed version (ground truth):
@Override public void restart(ExecutionVertexID executionVertexID,Configuration jobConfiguration){
  Environment ee=this.runningTasks.remove(executionVertexID);
  ee.restartExecution();
  for (int i=0; i < ee.getNumberOfInputGates(); i++) {
    InputGate<? extends Record> ingate=ee.getInputGate(i);
    for (int j=0; j < ingate.getNumberOfInputChannels(); j++) {
      if (!(ingate.getInputChannel(j) instanceof FileInputChannel<?>)) {
        this.byteBufferedChannelManager.clear(ingate.getInputChannel(j).getID());
      }
    }
  }
  for (int i=0; i < ee.getNumberOfOutputGates(); i++) {
    OutputGate<? extends Record> outgate=ee.getOutputGate(i);
    for (int j=0; j < outgate.getNumberOfOutputChannels(); j++) {
      this.byteBufferedChannelManager.clear(outgate.getOutputChannel(j).getID());
    }
  }
}
Program: 88040
Project: 88040
Buggy source:
/** 
 * @param 
 */
public void clear(ChannelID channelID){
  ByteBufferedChannelWrapper wrapper=this.registeredChannels.get(channelID);
  wrapper.clear();
}

Fixed version (ground truth):
/** 
 * @param 
 */
public void clear(ChannelID channelID){
  ByteBufferedChannelWrapper wrapper=this.registeredChannels.get(channelID);
  wrapper.clear();
  this.incomingConnectionThread.clear();
}
Program: 88041
Project: 88041
Buggy source:
/** 
 * @param byteBufferedChannelManager
 * @param fileInputChannel
 * @param sourceChannelID 
 * @return CheckpointOutgoingConnection
 */
public CheckpointOutgoingConnection createOutgoingCheckpointConnection(ByteBufferedChannelManager byteBufferedChannelManager,FileChannel fileInputChannel,ChannelID sourceChannelID){
  try {
    final InetSocketAddress connectionAddress=getPeerConnectionAddress(sourceChannelID);
    OutgoingConnectionThread connectionThread=new OutgoingConnectionThread();
    CheckpointOutgoingConnection outgoingConnection=new CheckpointOutgoingConnection(this,connectionAddress,connectionThread,10,fileInputChannel);
    this.outgoingConnections.put(connectionAddress,outgoingConnection);
    return outgoingConnection;
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param byteBufferedChannelManager
 * @param fileInputChannel
 * @param sourceChannelID 
 * @param address 
 * @return CheckpointOutgoingConnection
 */
public CheckpointOutgoingConnection createOutgoingCheckpointConnection(ByteBufferedChannelManager byteBufferedChannelManager,FileChannel fileInputChannel,ChannelID sourceChannelID){
  try {
    final InetSocketAddress connectionAddress=getPeerConnectionAddress(sourceChannelID);
    OutgoingConnectionThread connectionThread=new OutgoingConnectionThread();
    connectionThread.start();
    CheckpointOutgoingConnection outgoingConnection=new CheckpointOutgoingConnection(this,connectionAddress,connectionThread,10,fileInputChannel);
    this.outgoingConnections.put(connectionAddress,outgoingConnection);
    return outgoingConnection;
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return null;
}
Program: 88042
Project: 88042
Buggy source:
public void clear(){
  releaseAllResources();
  this.nextExpectedSequenceNumber=0;
}

Fixed version (ground truth):
public void clear(){
  releaseAllResources();
  this.nextExpectedSequenceNumber=0;
  this.byteBufferedInputChannel.clear();
}
Program: 88044
Project: 88044
Buggy source:
public void clear(){
  if (this.outgoingTransferEnvelope != null) {
    this.outgoingTransferEnvelope.getProcessingLog().setSentViaNetwork();
    this.outgoingTransferEnvelope=null;
  }
  this.sequenceNumber=0;
  if (this.uncompressedDataBuffer != null) {
    this.uncompressedDataBuffer.recycleBuffer();
  }
}

Fixed version (ground truth):
public void clear(){
  if (this.outgoingTransferEnvelope != null) {
    this.outgoingTransferEnvelope.getProcessingLog().setSentViaNetwork();
    this.outgoingTransferEnvelope=null;
  }
  this.sequenceNumber=0;
  if (this.uncompressedDataBuffer != null) {
    this.uncompressedDataBuffer.getInternalBuffer().recycleBuffer();
  }
}
Program: 88045
Project: 88045
Buggy source:
/** 
 * Sets the number of fields in the record. If the new number of fields is longer than the current number of fields, then null fields are appended. If the new number of fields is smaller than the current number of fields, then the last fields are truncated.
 * @param numFields The new number of fields.
 */
public void setNumFields(final int numFields){
  final int oldNumFields=this.numFields;
  if (numFields > oldNumFields) {
    makeSpace(numFields);
    for (int i=oldNumFields; i < numFields; i++) {
      this.offsets[i]=NULL_INDICATOR_OFFSET;
    }
  }
 else {
    if (this.lastUnmodifiedPos >= numFields)     this.lastUnmodifiedPos=numFields - 1;
  }
  this.numFields=numFields;
}

Fixed version (ground truth):
/** 
 * Sets the number of fields in the record. If the new number of fields is longer than the current number of fields, then null fields are appended. If the new number of fields is smaller than the current number of fields, then the last fields are truncated.
 * @param numFields The new number of fields.
 */
public void setNumFields(final int numFields){
  final int oldNumFields=this.numFields;
  if (numFields > oldNumFields) {
    makeSpace(numFields);
    for (int i=oldNumFields; i < numFields; i++) {
      this.offsets[i]=NULL_INDICATOR_OFFSET;
    }
  }
 else {
    if (this.lastUnmodifiedPos >= numFields)     this.lastUnmodifiedPos=numFields - 1;
    markModified(numFields);
  }
  this.numFields=numFields;
}
Program: 88046
Project: 88046
Buggy source:
private long byteBufferToLong(final ByteBuffer byteBuffer) throws IOException {
  long l=0;
  if (SIZEOFLONG > byteBuffer.limit()) {
    throw new IOException("String_Node_Str" + byteBuffer.limit() + "String_Node_Str");
  }
  for (int i=0; i < SIZEOFLONG; ++i) {
    l|=(byteBuffer.get((SIZEOFLONG - 1) - i) & 0xff) << (i << 3);
  }
  return l;
}

Fixed version (ground truth):
private long byteBufferToLong(final ByteBuffer byteBuffer) throws IOException {
  long l=0;
  if (SIZEOFLONG > byteBuffer.limit()) {
    throw new IOException("String_Node_Str" + byteBuffer.limit() + "String_Node_Str");
  }
  for (int i=0; i < SIZEOFLONG; ++i) {
    l|=(byteBuffer.get((SIZEOFLONG - 1) - i) & 0xffL) << (i << 3);
  }
  return l;
}
Program: 88047
Project: 88047
Buggy source:
private void longToByteBuffer(long longToSerialize,ByteBuffer byteBuffer) throws IOException {
  if (SIZEOFLONG > byteBuffer.capacity()) {
    throw new IOException("String_Node_Str" + byteBuffer.limit() + "String_Node_Str"+ SIZEOFLONG+ "String_Node_Str");
  }
  byteBuffer.limit(SIZEOFLONG);
  for (int i=0; i < SIZEOFLONG; ++i) {
    final int shift=i << 3;
    byteBuffer.put((SIZEOFLONG - 1) - i,(byte)((longToSerialize & (0xff << shift)) >>> shift));
  }
}

Fixed version (ground truth):
private void longToByteBuffer(long longToSerialize,ByteBuffer byteBuffer) throws IOException {
  if (SIZEOFLONG > byteBuffer.capacity()) {
    throw new IOException("String_Node_Str" + byteBuffer.limit() + "String_Node_Str"+ SIZEOFLONG+ "String_Node_Str");
  }
  byteBuffer.limit(SIZEOFLONG);
  for (int i=0; i < SIZEOFLONG; ++i) {
    final int shift=i << 3;
    byteBuffer.put((SIZEOFLONG - 1) - i,(byte)((longToSerialize & (0xffL << shift)) >>> shift));
  }
}
Program: 88048
Project: 88048
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void allocatedResourcesDied(final JobID jobID,final List<AllocatedResource> allocatedResources){
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void allocatedResourcesDied(final JobID jobID,final List<AllocatedResource> allocatedResources){
  for (  final AllocatedResource allocatedResource : allocatedResources) {
    LOG.info("String_Node_Str" + allocatedResource.getInstance().getName() + "String_Node_Str"+ jobID+ "String_Node_Str");
    ExecutionGraph job=this.jobQueue.getFirst();
synchronized (job) {
      Iterator<ExecutionGraph> iterator=this.jobQueue.descendingIterator();
      while (job.getJobID() != jobID) {
        if (iterator.hasNext()) {
          job=iterator.next();
        }
 else {
          LOG.error("String_Node_Str" + jobID + "String_Node_Str");
          return;
        }
      }
      List<ExecutionVertex> vertices=job.getVerticesAssignedToResource(allocatedResource);
      Iterator<ExecutionVertex> vertexIter=vertices.iterator();
      while (vertexIter.hasNext()) {
        ExecutionVertex vertex=vertexIter.next();
        vertex.updateExecutionState(ExecutionState.FAILED,"String_Node_Str" + allocatedResource.getInstance().getName() + "String_Node_Str"+ vertex.getEnvironment().getTaskName()+ "String_Node_Str");
        if (vertex.getExecutionState() == ExecutionState.FAILED) {
          job.executionStateChanged(jobID,vertex.getID(),ExecutionState.FAILED,"String_Node_Str" + allocatedResource.getInstance().getName() + "String_Node_Str"+ vertex.getEnvironment().getTaskName()+ "String_Node_Str");
          return;
        }
        vertex.setAllocatedResource(new AllocatedResource(DummyInstance.createDummyInstance(allocatedResource.getInstanceType()),allocatedResource.getInstanceType(),null));
      }
      try {
        LOG.info("String_Node_Str" + allocatedResource.getInstanceType().getIdentifier());
        final InstanceRequestMap instanceMap=new InstanceRequestMap();
        instanceMap.setMaximumNumberOfInstances(allocatedResource.getInstanceType(),1);
        instanceMap.setMinimumNumberOfInstances(allocatedResource.getInstanceType(),1);
        this.getInstanceManager().requestInstance(jobID,job.getJobConfiguration(),instanceMap,null);
      }
 catch (      InstanceException e) {
        e.printStackTrace();
      }
      job.executionStateChanged(jobID,vertices.get(0).getID(),ExecutionState.RECOVERING,null);
    }
  }
}
Program: 88049
Project: 88049
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public synchronized void executionStateChanged(final JobID jobID,final ExecutionVertexID vertexID,final ExecutionState newExecutionState,String optionalMessage){
  final InternalJobStatus oldStatus=this.jobStatus;
  checkAndUpdateJobStatus(newExecutionState);
  if (newExecutionState == ExecutionState.FINISHED) {
    if (this.isCurrentStageCompleted()) {
      ++this.indexToCurrentExecutionStage;
      if (this.indexToCurrentExecutionStage < this.stages.size()) {
        final Iterator<ExecutionStageListener> it=this.executionStageListeners.iterator();
        final ExecutionStage nextExecutionStage=getCurrentExecutionStage();
        while (it.hasNext()) {
          it.next().nextExecutionStageEntered(jobID,nextExecutionStage);
        }
      }
    }
  }
  if (this.jobStatus != oldStatus) {
    if (this.jobStatus == InternalJobStatus.FAILING) {
      this.errorDescription=optionalMessage;
    }
    if (this.jobStatus == InternalJobStatus.FAILED) {
      optionalMessage=this.errorDescription;
    }
    final Iterator<JobStatusListener> it=this.jobStatusListeners.iterator();
    while (it.hasNext()) {
      it.next().jobStatusHasChanged(this,this.jobStatus,optionalMessage);
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public synchronized void executionStateChanged(final JobID jobID,final ExecutionVertexID vertexID,final ExecutionState newExecutionState,String optionalMessage){
  final InternalJobStatus oldStatus=this.jobStatus;
  if (newExecutionState == ExecutionState.RERUNNING) {
    this.recovering.remove(getVertexByID(vertexID));
  }
  checkAndUpdateJobStatus(newExecutionState);
  if (newExecutionState == ExecutionState.FINISHED) {
    if (this.isCurrentStageCompleted()) {
      ++this.indexToCurrentExecutionStage;
      if (this.indexToCurrentExecutionStage < this.stages.size()) {
        final Iterator<ExecutionStageListener> it=this.executionStageListeners.iterator();
        final ExecutionStage nextExecutionStage=getCurrentExecutionStage();
        while (it.hasNext()) {
          it.next().nextExecutionStageEntered(jobID,nextExecutionStage);
        }
      }
    }
  }
  if (this.jobStatus == InternalJobStatus.RECOVERING) {
    LOG.info("String_Node_Str");
    this.recovering.add(this.getVertexByID(vertexID));
  }
  if (this.jobStatus != oldStatus) {
    if (this.jobStatus == InternalJobStatus.FAILING) {
      this.errorDescription=optionalMessage;
    }
    if (this.jobStatus == InternalJobStatus.FAILED) {
      optionalMessage=this.errorDescription;
    }
    final Iterator<JobStatusListener> it=this.jobStatusListeners.iterator();
    while (it.hasNext()) {
      it.next().jobStatusHasChanged(this,this.jobStatus,optionalMessage);
    }
  }
}
Program: 88051
Project: 88051
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void jobStatusHasChanged(final ExecutionGraph executionGraph,final InternalJobStatus newJobStatus,final String optionalMessage){
synchronized (executionGraph) {
    LOG.info("String_Node_Str" + executionGraph.getJobName() + "String_Node_Str"+ executionGraph.getJobID()+ "String_Node_Str"+ "String_Node_Str"+ newJobStatus);
  }
  if (newJobStatus == InternalJobStatus.CANCELING || newJobStatus == InternalJobStatus.FAILING) {
    cancelJob(executionGraph);
  }
  if (newJobStatus == InternalJobStatus.FINISHED) {
    removeAllCheckpoints(executionGraph);
  }
  if (newJobStatus == InternalJobStatus.CANCELED || newJobStatus == InternalJobStatus.FAILED || newJobStatus == InternalJobStatus.FINISHED) {
    unregisterJob(executionGraph);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void jobStatusHasChanged(final ExecutionGraph executionGraph,final InternalJobStatus newJobStatus,final String optionalMessage){
synchronized (executionGraph) {
    LOG.info("String_Node_Str" + executionGraph.getJobName() + "String_Node_Str"+ executionGraph.getJobID()+ "String_Node_Str"+ "String_Node_Str"+ newJobStatus);
  }
  if (newJobStatus == InternalJobStatus.CANCELING || newJobStatus == InternalJobStatus.FAILING) {
    cancelJob(executionGraph);
  }
  if (newJobStatus == InternalJobStatus.FINISHED) {
    removeAllCheckpoints(executionGraph);
  }
  if (newJobStatus == InternalJobStatus.CANCELED || newJobStatus == InternalJobStatus.FAILED || newJobStatus == InternalJobStatus.FINISHED) {
    unregisterJob(executionGraph);
  }
  if (newJobStatus == InternalJobStatus.RECOVERING) {
    try {
      RecoveryThread recoverythread=new RecoveryThread(executionGraph,this);
      recoverythread.start();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}
Program: 88052
Project: 88052
Buggy source:
private List<ExecutionVertex> findFollowers(ExecutionVertex vertex,ArrayList<ExecutionVertex> restart){
  ArrayList<ExecutionVertex> follower=new ArrayList<ExecutionVertex>();
  for (int i=0; i < vertex.getNumberOfSuccessors(); i++) {
    ExecutionVertex successor=vertex.getSuccessor(i);
    if (!restart.contains(successor)) {
      follower.add(successor);
      if (successor.getCheckpointState() == CheckpointState.COMPLETE) {
        this.checkpoints.remove(successor);
        final List<ExecutionVertexID> checkpointsToRemove=new ArrayList<ExecutionVertexID>();
        checkpointsToRemove.add(successor.getID());
        try {
          successor.getAllocatedResource().getInstance().removeCheckpoints(checkpointsToRemove);
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return follower;
}

Fixed version (ground truth):
private List<ExecutionVertex> findFollowers(ExecutionVertex vertex,ArrayList<ExecutionVertex> restart){
  ArrayList<ExecutionVertex> follower=new ArrayList<ExecutionVertex>();
  for (int i=0; i < vertex.getNumberOfSuccessors(); i++) {
    ExecutionVertex successor=vertex.getSuccessor(i);
    if (!restart.contains(successor)) {
      follower.add(successor);
      if (successor.getCheckpointState() == CheckpointState.PARTIAL) {
        this.checkpoints.remove(successor);
        final List<ExecutionVertexID> checkpointsToRemove=new ArrayList<ExecutionVertexID>();
        checkpointsToRemove.add(successor.getID());
        try {
          successor.getAllocatedResource().getInstance().removeCheckpoints(checkpointsToRemove);
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return follower;
}
Program: 88054
Project: 88054
Buggy source:
void executionStateChanged(final JobID jobID,final ExecutionVertexID id,final Task task,final ExecutionState newExecutionState,final String optionalDescription){
  if (newExecutionState == ExecutionState.RUNNING) {
synchronized (this.runningTasks) {
      this.runningTasks.put(id,task);
    }
  }
  if (newExecutionState == ExecutionState.FINISHED || newExecutionState == ExecutionState.CANCELED || newExecutionState == ExecutionState.FAILED) {
synchronized (this.runningTasks) {
      this.runningTasks.remove(id);
    }
    unregisterTask(id,task);
  }
synchronized (this.jobManager) {
    try {
      this.jobManager.updateTaskExecutionState(new TaskExecutionState(jobID,id,newExecutionState,optionalDescription));
    }
 catch (    IOException e) {
      LOG.error(StringUtils.stringifyException(e));
    }
  }
}

Fixed version (ground truth):
void executionStateChanged(final JobID jobID,final ExecutionVertexID id,final Task task,final ExecutionState newExecutionState,final String optionalDescription){
  if (newExecutionState == ExecutionState.RUNNING || newExecutionState == ExecutionState.RUNNING) {
synchronized (this.runningTasks) {
      this.runningTasks.put(id,task);
    }
  }
  if (newExecutionState == ExecutionState.FINISHED || newExecutionState == ExecutionState.CANCELED || newExecutionState == ExecutionState.FAILED) {
synchronized (this.runningTasks) {
      this.runningTasks.remove(id);
    }
    unregisterTask(id,task);
  }
synchronized (this.jobManager) {
    try {
      this.jobManager.updateTaskExecutionState(new TaskExecutionState(jobID,id,newExecutionState,optionalDescription));
    }
 catch (    IOException e) {
      LOG.error(StringUtils.stringifyException(e));
    }
  }
}
Program: 88055
Project: 88055
Buggy source:
/** 
 * Initializes the PactString to a sub-string of the given PactString. 
 * @param value The string containing the substring.
 * @param offset The offset of the substring.
 * @param len The length of the substring.
 */
public PactString(final PactString value,final int offset,final int len){
  setValue(value,offset,len);
}

Fixed version (ground truth):
/** 
 * Initializes the PactString to a sub-string of the given PactString. 
 * @param value The string containing the substring.
 * @param offset The offset of the substring.
 * @param len The length of the substring.
 */
public PactString(final PactString value,final int offset,final int len){
  this.value=EMPTY_STRING;
  setValue(value,offset,len);
}
Program: 88056
Project: 88056
Buggy source:
/** 
 * Writes this buffer completely to the given writer.
 * @param writer The writer to write the segment to.
 * @throws IOException Thrown, if the writer caused an I/O exception.
 */
public void writeToChannel(final Writer writer) throws IOException {
  int recordsLeft=this.numRecords;
  int currentMemSeg=0;
  while (recordsLeft > 0) {
    final MemorySegment currentIndexSegment=this.sortIndex.get(currentMemSeg++);
    int offset=0;
    if (recordsLeft >= this.indexEntriesPerSegment) {
      for (; offset <= this.lastIndexEntryOffset; offset+=this.indexEntrySize) {
        final long pointer=currentIndexSegment.getLong(offset);
      }
      recordsLeft-=this.indexEntriesPerSegment;
    }
 else {
      for (; recordsLeft > 0; recordsLeft--, offset+=this.indexEntrySize) {
        final long pointer=currentIndexSegment.getLong(offset);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes this buffer completely to the given writer.
 * @param writer The writer to write the segment to.
 * @throws IOException Thrown, if the writer caused an I/O exception.
 */
public void writeToChannel(final Writer writer) throws IOException {
  throw new UnsupportedOperationException();
}
Program: 88057
Project: 88057
Buggy source:
public void setKey(int key){
  this.key=key;
}

Fixed version (ground truth):
public void setKey(int key){
  setValue(key);
}
Program: 88058
Project: 88058
Buggy source:
public int getKey(){
  return key;
}

Fixed version (ground truth):
public int getKey(){
  return getValue();
}
Program: 88059
Project: 88059
Buggy source:
public Key(int k){
  key=k;
}

Fixed version (ground truth):
public Key(int k){
  super(k);
}
Program: 88060
Project: 88060
Buggy source:
public int compare(int i,int j){
  final int bufferNumI=i / this.indexEntriesPerSegment;
  final int segmentOffsetI=(i % this.indexEntriesPerSegment) * this.indexEntrySize;
  final int bufferNumJ=j / this.indexEntriesPerSegment;
  final int segmentOffsetJ=(j % this.indexEntriesPerSegment) * this.indexEntrySize;
  final MemorySegment segI=this.sortIndex.get(bufferNumI);
  final MemorySegment segJ=this.sortIndex.get(bufferNumJ);
  final byte[] bI=segI.getBackingArray();
  final byte[] bJ=segJ.getBackingArray();
  int val=0;
  for (int pos=0, posI=segI.translateOffset(segmentOffsetI + OFFSET_LEN), posJ=segJ.translateOffset(segmentOffsetJ + OFFSET_LEN); pos < this.numKeyBytes & (val=(bI[posI] & 0xff) - (bJ[posJ] & 0xff)) == 0; pos++, posI++, posJ++)   ;
  if (val != 0 || this.normalizedKeyFullyDetermines) {
    return val;
  }
  final long pointerI=segI.getLong(segmentOffsetI);
  final long pointerJ=segJ.getLong(segmentOffsetJ);
  return compareRecords(pointerI,pointerJ);
}

Fixed version (ground truth):
public int compare(int i,int j){
  final int bufferNumI=i / this.indexEntriesPerSegment;
  final int segmentOffsetI=(i % this.indexEntriesPerSegment) * this.indexEntrySize;
  final int bufferNumJ=j / this.indexEntriesPerSegment;
  final int segmentOffsetJ=(j % this.indexEntriesPerSegment) * this.indexEntrySize;
  final MemorySegment segI=this.sortIndex.get(bufferNumI);
  final MemorySegment segJ=this.sortIndex.get(bufferNumJ);
  final byte[] bI=segI.getBackingArray();
  final byte[] bJ=segJ.getBackingArray();
  int val=0;
  for (int pos=0, posI=segI.translateOffset(segmentOffsetI + OFFSET_LEN), posJ=segJ.translateOffset(segmentOffsetJ + OFFSET_LEN); pos < this.numKeyBytes && (val=(bI[posI] & 0xff) - (bJ[posJ] & 0xff)) == 0; pos++, posI++, posJ++)   ;
  if (val != 0 || this.normalizedKeyFullyDetermines) {
    return val;
  }
  final long pointerI=segI.getLong(segmentOffsetI);
  final long pointerJ=segJ.getLong(segmentOffsetJ);
  return compareRecords(pointerI,pointerJ);
}
Program: 88061
Project: 88061
Buggy source:
public List<MemorySegment> dispose(){
  this.freeMemory.addAll(this.sortIndex);
  this.freeMemory.addAll(this.recordBuffers);
  this.recordBuffers.clear();
  this.sortIndex.clear();
  return this.freeMemory;
}

Fixed version (ground truth):
/** 
 * Collects all memory segments from this sorter.
 * @return All memory segments from this sorter.
 */
public List<MemorySegment> dispose(){
  this.freeMemory.addAll(this.sortIndex);
  this.freeMemory.addAll(this.recordBuffers);
  this.recordBuffers.clear();
  this.sortIndex.clear();
  return this.freeMemory;
}
Program: 88062
Project: 88062
Buggy source:
@Test public void testSort() throws Exception {
  final int numSegments=MEMORY_SIZE / MEMORY_SEGMENT_SIZE;
  final List<MemorySegment> memory=this.memoryManager.allocate(new DummyInvokable(),numSegments,MEMORY_SEGMENT_SIZE);
  NormalizedKeySorter<PactRecord> sorter=newSortBuffer(memory);
  TestData.Generator generator=new TestData.Generator(SEED,KEY_MAX,VALUE_LENGTH,KeyMode.RANDOM,ValueMode.RANDOM_LENGTH);
  long writeStart=System.nanoTime();
  PactRecord record=new PactRecord();
  do {
    generator.next(record);
  }
 while (sorter.write(record));
  long writeStop=System.nanoTime();
  System.out.println("String_Node_Str" + (writeStop - writeStart) / 1000000 + "String_Node_Str");
  long sortStart=System.nanoTime();
  QuickSort qs=new QuickSort();
  qs.sort(sorter);
  long sortStop=System.nanoTime();
  System.out.println("String_Node_Str" + (sortStop - sortStart) / 1000000 + "String_Node_Str");
  MutableObjectIterator<PactRecord> iter=sorter.getIterator();
  PactRecord readTarget=new PactRecord();
  Key current=new Key();
  Key last=new Key();
  iter.next(readTarget);
  readTarget.getFieldInto(0,last);
  while (iter.next(readTarget)) {
    readTarget.getFieldInto(0,current);
    final int cmp=last.compareTo(current);
    if (cmp > 0)     Assert.fail("String_Node_Str");
    Key tmp=current;
    current=last;
    last=tmp;
  }
  this.memoryManager.release(sorter.dispose());
}

Fixed version (ground truth):
@Test public void testSort() throws Exception {
  final int numSegments=MEMORY_SIZE / MEMORY_SEGMENT_SIZE;
  final List<MemorySegment> memory=this.memoryManager.allocate(new DummyInvokable(),numSegments,MEMORY_SEGMENT_SIZE);
  NormalizedKeySorter<PactRecord> sorter=newSortBuffer(memory);
  TestData.Generator generator=new TestData.Generator(SEED,KEY_MAX,VALUE_LENGTH,KeyMode.RANDOM,ValueMode.RANDOM_LENGTH);
  PactRecord record=new PactRecord();
  do {
    generator.next(record);
  }
 while (sorter.write(record));
  QuickSort qs=new QuickSort();
  qs.sort(sorter);
  MutableObjectIterator<PactRecord> iter=sorter.getIterator();
  PactRecord readTarget=new PactRecord();
  Key current=new Key();
  Key last=new Key();
  iter.next(readTarget);
  readTarget.getFieldInto(0,last);
  while (iter.next(readTarget)) {
    readTarget.getFieldInto(0,current);
    final int cmp=last.compareTo(current);
    if (cmp > 0)     Assert.fail("String_Node_Str");
    Key tmp=current;
    current=last;
    last=tmp;
  }
  this.memoryManager.release(sorter.dispose());
}
Program: 88063
Project: 88063
Buggy source:
/** 
 * Emit the candidate.
 * @param left
 * @param right
 */
protected void emitCandidate(KeyValuePair<JsonNode,JsonNode> left,KeyValuePair<JsonNode,JsonNode> right){
  EvaluationExpression resultProjection1=this.resultProjection1, resultProjection2=this.resultProjection2;
  if (resultProjection1 == null)   resultProjection1=EvaluationExpression.VALUE;
  if (resultProjection2 == null)   resultProjection2=EvaluationExpression.VALUE;
  final EvaluationContext context=this.getContext();
  this.sopremoTestPlan.getExpectedOutput(0).add(createPactJsonArray(resultProjection1.evaluate(left.getValue(),context),resultProjection2.evaluate(right.getValue(),context)));
}

Fixed version (ground truth):
/** 
 * Emit the candidate.
 * @param left
 * @param right
 */
protected void emitCandidate(KeyValuePair<JsonNode,JsonNode> left,KeyValuePair<JsonNode,JsonNode> right){
  EvaluationExpression resultProjection1=this.resultProjection1, resultProjection2=this.resultProjection2;
  if (resultProjection1 == null)   resultProjection1=EvaluationExpression.VALUE;
  if (resultProjection2 == null)   resultProjection2=EvaluationExpression.VALUE;
  final EvaluationContext context=this.getContext();
  this.sopremoTestPlan.getExpectedOutput(0).add(new ArrayNode(resultProjection1.evaluate(left.getValue(),context),resultProjection2.evaluate(right.getValue(),context)));
}
Program: 88064
Project: 88064
Buggy source:
private JsonNode flatArrayOfElements(SopremoTestPlan testPlan,int[]... ids){
  ArrayNode array=new ArrayNode();
  for (int sourceIndex=0; sourceIndex < ids.length; sourceIndex++) {
    EvaluationExpression resultProjection=this.resultProjections[sourceIndex];
    if (resultProjection == null)     resultProjection=EvaluationExpression.VALUE;
    for (int tupleIndex=0; tupleIndex < ids[sourceIndex].length; tupleIndex++)     array.add(resultProjection.evaluate(this.findTuple(testPlan,sourceIndex,ids[sourceIndex][tupleIndex]),testPlan.getEvaluationContext()));
  }
  return new JsonNode(array);
}

Fixed version (ground truth):
private JsonNode flatArrayOfElements(SopremoTestPlan testPlan,int[]... ids){
  ArrayNode array=new ArrayNode();
  for (int sourceIndex=0; sourceIndex < ids.length; sourceIndex++) {
    EvaluationExpression resultProjection=this.resultProjections[sourceIndex];
    if (resultProjection == null)     resultProjection=EvaluationExpression.VALUE;
    for (int tupleIndex=0; tupleIndex < ids[sourceIndex].length; tupleIndex++)     array.add(resultProjection.evaluate(this.findTuple(testPlan,sourceIndex,ids[sourceIndex][tupleIndex]),testPlan.getEvaluationContext()));
  }
  return new ArrayNode(array);
}