nus-yam/ex-repair huggingface dataset:
Program: 55924
Project: 55924
Buggy source:
/** 
 * Requests an empty buffer with a minimum size of <code>minimumSizeOfBuffer</code>. The method returns immediately, even if the request could not be fulfilled. Note that <code>minimumSizeOfBuffer</code> must not exceed the value returned by the method <code>getMaximumBufferSize()</code>.
 * @param minimumSizeOfBuffer the minimum size of the requested read buffer in bytes
 * @return the buffer with at least the requested size or <code>null</code> if no such buffer is currently available
 * @throws IOException thrown if an I/O error occurs while allocating the buffer
 */
Buffer requestEmptyBuffer(int minimumSizeOfBuffer) throws IOException ;

Fixed version (ground truth):
/** 
 * Requests an empty buffer with a minimum size of <code>minimumSizeOfBuffer</code>. The method returns immediately, even if the request could not be fulfilled. Note that <code>minimumSizeOfBuffer</code> must not exceed the value returned by the method <code>getMaximumBufferSize()</code>.
 * @param minimumSizeOfBuffer the minimum size of the requested read buffer in bytes
 * @param minimumReserve the minimum buffer reserve that must be kept by the buffer provider
 * @return the buffer with at least the requested size or <code>null</code> if no such buffer is currently available
 * @throws IOException thrown if an I/O error occurs while allocating the buffer
 */
Buffer requestEmptyBuffer(int minimumSizeOfBuffer,int minimumReserve) throws IOException ;
Program: 55925
Project: 55925
Buggy source:
/** 
 * Requests an empty buffer with a minimum size of <code>minimumSizeOfBuffer</code>. The method blocks until the request can be fulfilled. Note that <code>minimumSizeOfBuffer</code> must not exceed the value returned by the method <code>getMaximumBufferSize()</code>.
 * @param minimumSizeOfBuffer the minimum size of the requested read buffer in bytes
 * @return the buffer with at least the requested size
 * @throws IOException thrown if an I/O error occurs while allocating the buffer
 * @throws InterruptedException thrown if the thread waiting for the buffer is interrupted
 */
Buffer requestEmptyBufferBlocking(int minimumSizeOfBuffer) throws IOException, InterruptedException ;

Fixed version (ground truth):
/** 
 * Requests an empty buffer with a minimum size of <code>minimumSizeOfBuffer</code>. The method blocks until the request can be fulfilled. Note that <code>minimumSizeOfBuffer</code> must not exceed the value returned by the method <code>getMaximumBufferSize()</code>.
 * @param minimumSizeOfBuffer the minimum size of the requested read buffer in bytes
 * @param minimumReserve the minimum buffer reserve that must be kept by the buffer provider
 * @return the buffer with at least the requested size
 * @throws IOException thrown if an I/O error occurs while allocating the buffer
 * @throws InterruptedException thrown if the thread waiting for the buffer is interrupted
 */
Buffer requestEmptyBufferBlocking(int minimumSizeOfBuffer,int minimumReserve) throws IOException, InterruptedException ;
Program: 55926
Project: 55926
Buggy source:
/** 
 * Sets the designated number of buffers for this local buffer cache.
 * @param designatedNumberOfBuffers the designated number of buffers for this local buffer cache
 */
public void setDesignatedNumberOfBuffers(final int designatedNumberOfBuffers){
synchronized (this.buffers) {
    this.designatedNumberOfBuffers=designatedNumberOfBuffers;
    while (this.designatedNumberOfBuffers > this.requestedNumberOfBuffers) {
      if (this.buffers.isEmpty()) {
        break;
      }
      this.globalBufferPool.releaseGlobalBuffer(this.buffers.poll());
      this.requestedNumberOfBuffers--;
    }
    this.buffers.notify();
  }
}

Fixed version (ground truth):
/** 
 * Sets the designated number of buffers for this local buffer cache.
 * @param designatedNumberOfBuffers the designated number of buffers for this local buffer cache
 */
public void setDesignatedNumberOfBuffers(final int designatedNumberOfBuffers){
synchronized (this.buffers) {
    this.designatedNumberOfBuffers=designatedNumberOfBuffers;
    while (this.requestedNumberOfBuffers > this.designatedNumberOfBuffers) {
      if (this.buffers.isEmpty()) {
        break;
      }
      this.globalBufferPool.releaseGlobalBuffer(this.buffers.poll());
      this.requestedNumberOfBuffers--;
    }
    this.buffers.notify();
  }
}
Program: 55927
Project: 55927
Buggy source:
private Buffer requestBufferInternal(final int minimumSizeOfBuffer,final boolean block) throws InterruptedException {
  if (minimumSizeOfBuffer > this.maximumBufferSize) {
    throw new IllegalArgumentException("String_Node_Str" + minimumSizeOfBuffer + "String_Node_Str"+ this.maximumBufferSize);
  }
synchronized (this.buffers) {
    if (this.requestedNumberOfBuffers > this.designatedNumberOfBuffers) {
      while (this.requestedNumberOfBuffers < this.designatedNumberOfBuffers) {
        final ByteBuffer buffer=this.buffers.poll();
        if (buffer == null) {
          break;
        }
        this.globalBufferPool.releaseGlobalBuffer(buffer);
        this.requestedNumberOfBuffers--;
      }
    }
    while (this.buffers.isEmpty()) {
      if (this.requestedNumberOfBuffers < this.designatedNumberOfBuffers) {
        final ByteBuffer buffer=this.globalBufferPool.lockGlobalBuffer();
        if (buffer != null) {
          this.buffers.add(buffer);
          this.requestedNumberOfBuffers++;
          continue;
        }
      }
      if (block) {
        this.buffers.wait();
      }
 else {
        return null;
      }
    }
    final ByteBuffer byteBuffer=this.buffers.poll();
    return BufferFactory.createFromMemory(minimumSizeOfBuffer,byteBuffer,this.buffers);
  }
}

Fixed version (ground truth):
private Buffer requestBufferInternal(final int minimumSizeOfBuffer,int minimumReserve,final boolean block) throws InterruptedException {
  if (minimumSizeOfBuffer > this.maximumBufferSize) {
    throw new IllegalArgumentException("String_Node_Str" + minimumSizeOfBuffer + "String_Node_Str"+ this.maximumBufferSize);
  }
synchronized (this.buffers) {
    while (this.requestedNumberOfBuffers > this.designatedNumberOfBuffers) {
      final ByteBuffer buffer=this.buffers.poll();
      if (buffer == null) {
        break;
      }
      this.globalBufferPool.releaseGlobalBuffer(buffer);
      this.requestedNumberOfBuffers--;
    }
    if (minimumReserve > this.requestedNumberOfBuffers) {
      LOG.warn("String_Node_Str");
      minimumReserve=this.requestedNumberOfBuffers;
    }
    while (this.buffers.size() <= minimumReserve) {
      if (this.requestedNumberOfBuffers < this.designatedNumberOfBuffers) {
        final ByteBuffer buffer=this.globalBufferPool.lockGlobalBuffer();
        if (buffer != null) {
          this.buffers.add(buffer);
          this.requestedNumberOfBuffers++;
          continue;
        }
      }
      if (block) {
        this.buffers.wait();
      }
 else {
        return null;
      }
    }
    final ByteBuffer byteBuffer=this.buffers.poll();
    return BufferFactory.createFromMemory(minimumSizeOfBuffer,byteBuffer,this.buffers);
  }
}
Program: 55928
Project: 55928
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Buffer requestEmptyBuffer(final int minimumSizeOfBuffer) throws IOException {
  try {
    return requestBufferInternal(minimumSizeOfBuffer,false);
  }
 catch (  InterruptedException e) {
    LOG.error("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Buffer requestEmptyBuffer(final int minimumSizeOfBuffer,final int minimumReserve) throws IOException {
  try {
    return requestBufferInternal(minimumSizeOfBuffer,minimumReserve,false);
  }
 catch (  InterruptedException e) {
    LOG.error("String_Node_Str");
  }
  return null;
}
Program: 55929
Project: 55929
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Buffer requestEmptyBufferBlocking(int minimumSizeOfBuffer) throws IOException, InterruptedException {
  return requestBufferInternal(minimumSizeOfBuffer,true);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Buffer requestEmptyBufferBlocking(final int minimumSizeOfBuffer,final int minimumReserve) throws IOException, InterruptedException {
  return requestBufferInternal(minimumSizeOfBuffer,minimumReserve,true);
}
Program: 55931
Project: 55931
Buggy source:
@Override public Buffer requestEmptyBuffer(int minimumSizeOfBuffer) throws IOException {
  return this.inputGateContext.requestEmptyBuffer(minimumSizeOfBuffer);
}

Fixed version (ground truth):
@Override public Buffer requestEmptyBuffer(final int minimumSizeOfBuffer,final int minimumReserve) throws IOException {
  return this.inputGateContext.requestEmptyBuffer(minimumSizeOfBuffer,minimumReserve);
}
Program: 55932
Project: 55932
Buggy source:
@Override public Buffer requestEmptyBufferBlocking(int minimumSizeOfBuffer) throws IOException, InterruptedException {
  return this.inputGateContext.requestEmptyBufferBlocking(minimumSizeOfBuffer);
}

Fixed version (ground truth):
@Override public Buffer requestEmptyBufferBlocking(final int minimumSizeOfBuffer,final int minimumReserve) throws IOException, InterruptedException {
  return this.inputGateContext.requestEmptyBufferBlocking(minimumSizeOfBuffer,minimumReserve);
}
Program: 55933
Project: 55933
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Buffer requestEmptyBuffer(final int minimumSizeOfBuffer) throws IOException {
  return this.taskContext.requestEmptyBuffer(minimumSizeOfBuffer);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Buffer requestEmptyBuffer(final int minimumSizeOfBuffer,final int minimumReserve) throws IOException {
  return this.taskContext.requestEmptyBuffer(minimumSizeOfBuffer,minimumReserve);
}
Program: 55934
Project: 55934
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Buffer requestEmptyBufferBlocking(final int minimumSizeOfBuffer) throws IOException, InterruptedException {
  return this.taskContext.requestEmptyBufferBlocking(minimumSizeOfBuffer);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Buffer requestEmptyBufferBlocking(final int minimumSizeOfBuffer,final int minimumReserve) throws IOException, InterruptedException {
  return this.taskContext.requestEmptyBufferBlocking(minimumSizeOfBuffer,minimumReserve);
}
Program: 55935
Project: 55935
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void releaseWriteBuffers() throws IOException, InterruptedException {
  if (this.outgoingTransferEnvelope == null) {
    LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID());
    return;
  }
  if (this.outgoingTransferEnvelope.getBuffer() == null) {
    LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID() + "String_Node_Str");
    return;
  }
  try {
    this.outgoingTransferEnvelope.getBuffer().finishWritePhase();
  }
 catch (  final IOException ioe) {
    this.byteBufferedOutputChannel.reportIOException(ioe);
  }
  if (!this.isReceiverRunning) {
    final Buffer memBuffer=this.outgoingTransferEnvelope.getBuffer();
    final Buffer fileBuffer=this.outputGateContext.getFileBuffer(memBuffer.size());
    memBuffer.copyToBuffer(fileBuffer);
    this.outgoingTransferEnvelope.setBuffer(fileBuffer);
    this.queuedOutgoingEnvelopes.add(this.outgoingTransferEnvelope);
    this.outgoingTransferEnvelope=null;
    memBuffer.recycleBuffer();
    return;
  }
  while (!this.queuedOutgoingEnvelopes.isEmpty()) {
    this.outputGateContext.processEnvelope(this.queuedOutgoingEnvelopes.poll());
  }
  this.outputGateContext.processEnvelope(this.outgoingTransferEnvelope);
  this.outgoingTransferEnvelope=null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void releaseWriteBuffers() throws IOException, InterruptedException {
  if (this.outgoingTransferEnvelope == null) {
    LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID());
    return;
  }
  if (this.outgoingTransferEnvelope.getBuffer() == null) {
    LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID() + "String_Node_Str");
    return;
  }
  try {
    this.outgoingTransferEnvelope.getBuffer().finishWritePhase();
  }
 catch (  final IOException ioe) {
    this.byteBufferedOutputChannel.reportIOException(ioe);
  }
  if (!this.isReceiverRunning) {
    final Buffer memBuffer=this.outgoingTransferEnvelope.getBuffer();
    final Buffer fileBuffer=this.outputGateContext.getFileBuffer(memBuffer.size());
    memBuffer.copyToBuffer(fileBuffer);
    this.outgoingTransferEnvelope.setBuffer(fileBuffer);
    this.queuedOutgoingEnvelopes.add(this.outgoingTransferEnvelope);
    this.outgoingTransferEnvelope=null;
    memBuffer.recycleBuffer();
    return;
  }
  while (!this.queuedOutgoingEnvelopes.isEmpty()) {
    this.outputGateContext.processEnvelope(this,this.queuedOutgoingEnvelopes.poll());
  }
  this.outputGateContext.processEnvelope(this,this.outgoingTransferEnvelope);
  this.outgoingTransferEnvelope=null;
}
Program: 55936
Project: 55936
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public BufferPairResponse requestEmptyWriteBuffers() throws InterruptedException, IOException {
  if (this.outgoingTransferEnvelope == null) {
    this.outgoingTransferEnvelope=createNewOutgoingTransferEnvelope();
  }
 else {
    if (this.outgoingTransferEnvelope.getBuffer() != null) {
      LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID() + "String_Node_Str");
      return null;
    }
  }
  final int uncompressedBufferSize=calculateBufferSize();
  final Buffer buffer=this.outputGateContext.requestEmptyBufferBlocking(uncompressedBufferSize);
  final BufferPairResponse bufferResponse=new BufferPairResponse(null,buffer);
  this.outgoingTransferEnvelope.setBuffer(bufferResponse.getUncompressedDataBuffer());
  return bufferResponse;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public BufferPairResponse requestEmptyWriteBuffers() throws InterruptedException, IOException {
  if (this.outgoingTransferEnvelope == null) {
    this.outgoingTransferEnvelope=createNewOutgoingTransferEnvelope();
  }
 else {
    if (this.outgoingTransferEnvelope.getBuffer() != null) {
      LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID() + "String_Node_Str");
      return null;
    }
  }
  final int uncompressedBufferSize=calculateBufferSize();
  final Buffer buffer=this.outputGateContext.requestEmptyBufferBlocking(this,uncompressedBufferSize);
  final BufferPairResponse bufferResponse=new BufferPairResponse(null,buffer);
  this.outgoingTransferEnvelope.setBuffer(bufferResponse.getUncompressedDataBuffer());
  return bufferResponse;
}
Program: 55937
Project: 55937
Buggy source:
@Override public boolean hasDataLeftToTransmit() throws IOException, InterruptedException {
  if (!this.isReceiverRunning) {
    return true;
  }
  while (!this.queuedOutgoingEnvelopes.isEmpty()) {
    this.outputGateContext.processEnvelope(this.queuedOutgoingEnvelopes.poll());
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean hasDataLeftToTransmit() throws IOException, InterruptedException {
  if (!this.isReceiverRunning) {
    return true;
  }
  while (!this.queuedOutgoingEnvelopes.isEmpty()) {
    this.outputGateContext.processEnvelope(this,this.queuedOutgoingEnvelopes.poll());
  }
  return false;
}
Program: 55938
Project: 55938
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void transferEventToInputChannel(final AbstractEvent event) throws IOException, InterruptedException {
  if (this.outgoingTransferEnvelope != null) {
    this.outgoingTransferEnvelope.addEvent(event);
  }
 else {
    final TransferEnvelope ephemeralTransferEnvelope=createNewOutgoingTransferEnvelope();
    ephemeralTransferEnvelope.addEvent(event);
    if (!this.isReceiverRunning) {
      this.queuedOutgoingEnvelopes.add(ephemeralTransferEnvelope);
      return;
    }
    while (!this.queuedOutgoingEnvelopes.isEmpty()) {
      this.outputGateContext.processEnvelope(this.queuedOutgoingEnvelopes.poll());
    }
    this.outputGateContext.processEnvelope(ephemeralTransferEnvelope);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void transferEventToInputChannel(final AbstractEvent event) throws IOException, InterruptedException {
  if (this.outgoingTransferEnvelope != null) {
    this.outgoingTransferEnvelope.addEvent(event);
  }
 else {
    final TransferEnvelope ephemeralTransferEnvelope=createNewOutgoingTransferEnvelope();
    ephemeralTransferEnvelope.addEvent(event);
    if (!this.isReceiverRunning) {
      this.queuedOutgoingEnvelopes.add(ephemeralTransferEnvelope);
      return;
    }
    while (!this.queuedOutgoingEnvelopes.isEmpty()) {
      this.outputGateContext.processEnvelope(this,this.queuedOutgoingEnvelopes.poll());
    }
    this.outputGateContext.processEnvelope(this,ephemeralTransferEnvelope);
  }
}
Program: 55939
Project: 55939
Buggy source:
/** 
 * Unregisters the given job represented by its   {@link ExecutionGraph} with the input split manager.
 * @param executionGraph the job to be unregistered
 */
public void unregisterJob(final ExecutionGraph executionGraph){
  final Iterator<ExecutionGroupVertex> it=new ExecutionGroupVertexIterator(executionGraph,true,-1);
  while (it.hasNext()) {
    final ExecutionGroupVertex groupVertex=it.next();
    final InputSplitAssigner assigner=this.assignerCache.remove(groupVertex);
    if (assigner == null) {
      LOG.error("String_Node_Str" + groupVertex.getName() + "String_Node_Str");
      continue;
    }
    assigner.unregisterGroupVertex(groupVertex);
  }
}

Fixed version (ground truth):
/** 
 * Unregisters the given job represented by its   {@link ExecutionGraph} with the input split manager.
 * @param executionGraph the job to be unregistered
 */
public void unregisterJob(final ExecutionGraph executionGraph){
  final Iterator<ExecutionGroupVertex> it=new ExecutionGroupVertexIterator(executionGraph,true,-1);
  while (it.hasNext()) {
    final ExecutionGroupVertex groupVertex=it.next();
    final InputSplit[] inputSplits=groupVertex.getInputSplits();
    if (inputSplits == null) {
      continue;
    }
    if (inputSplits.length == 0) {
      continue;
    }
    final InputSplitAssigner assigner=this.assignerCache.remove(groupVertex);
    if (assigner == null) {
      LOG.error("String_Node_Str" + groupVertex.getName() + "String_Node_Str");
      continue;
    }
    assigner.unregisterGroupVertex(groupVertex);
  }
}
Program: 55940
Project: 55940
Buggy source:
@Override public void copyToBuffer(final Buffer destinationBuffer) throws IOException {
  if (destinationBuffer.isBackedByMemory()) {
    final long tbr=this.totalBytesRead;
    if (this.fileChannel != null) {
      this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID);
    }
    this.totalBytesRead=0;
    destinationBuffer.write(this);
    destinationBuffer.finishWritePhase();
    if (this.fileChannel != null) {
      this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID);
    }
    this.fileChannel=null;
    this.totalBytesRead=tbr;
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public void copyToBuffer(final Buffer destinationBuffer) throws IOException {
  if (destinationBuffer.isBackedByMemory()) {
    final long tbr=this.totalBytesRead;
    if (this.fileChannel != null) {
      this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID);
    }
    this.totalBytesRead=0;
    while (remaining() > 0) {
      destinationBuffer.write(this);
    }
    destinationBuffer.finishWritePhase();
    if (this.fileChannel != null) {
      this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID);
    }
    this.fileChannel=null;
    this.totalBytesRead=tbr;
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 55941
Project: 55941
Buggy source:
@Override public void copyToBuffer(Buffer destinationBuffer) throws IOException {
  final int oldPos=this.byteBuffer.position();
  while (remaining() > 0) {
    destinationBuffer.write(this);
  }
  this.byteBuffer.position(oldPos);
  if (!this.writeMode) {
    destinationBuffer.finishWritePhase();
  }
}

Fixed version (ground truth):
@Override public void copyToBuffer(Buffer destinationBuffer) throws IOException {
  final int oldPos=this.byteBuffer.position();
  this.byteBuffer.position(0);
  while (remaining() > 0) {
    destinationBuffer.write(this);
  }
  this.byteBuffer.position(oldPos);
  destinationBuffer.finishWritePhase();
}
Program: 55942
Project: 55942
Buggy source:
@Override public Map<InstanceType,InstanceTypeDescription> getMapOfAvailableInstanceTypes(){
  Map<InstanceType,InstanceTypeDescription> availableinstances=new HashMap<InstanceType,InstanceTypeDescription>();
  for (  InstanceType t : this.availableInstanceTypes) {
    availableinstances.put(t,InstanceTypeDescriptionFactory.construct(t,null,-1));
  }
  return availableinstances;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Map<InstanceType,InstanceTypeDescription> getMapOfAvailableInstanceTypes(){
  final Map<InstanceType,InstanceTypeDescription> availableinstances=new SerializableHashMap<InstanceType,InstanceTypeDescription>();
  for (  InstanceType t : this.availableInstanceTypes) {
    availableinstances.put(t,InstanceTypeDescriptionFactory.construct(t,null,-1));
  }
  return availableinstances;
}
Program: 55943
Project: 55943
Buggy source:
@Override public InternalBuffer duplicate() throws IOException, InterruptedException {
  this.fileBufferManager.increaseFileCounter(this.gateID,this.fileID);
  final FileBuffer dup=new FileBuffer((int)this.bufferSize,this.gateID,this.fileBufferManager);
  dup.writeMode=this.writeMode;
  dup.fileID=this.fileID;
  dup.offset=this.offset;
  return dup;
}

Fixed version (ground truth):
@Override public InternalBuffer duplicate() throws IOException, InterruptedException {
  this.fileBufferManager.increaseBufferCounter(this.gateID,this.fileID);
  final FileBuffer dup=new FileBuffer((int)this.bufferSize,this.gateID,this.fileBufferManager);
  dup.writeMode=this.writeMode;
  dup.fileID=this.fileID;
  dup.offset=this.offset;
  return dup;
}
Program: 55944
Project: 55944
Buggy source:
@Override public void recycleBuffer(){
  this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID,true);
}

Fixed version (ground truth):
@Override public void recycleBuffer(){
  try {
    if (this.fileChannel != null) {
      this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID);
      this.fileChannel=null;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  this.fileBufferManager.decreaseBufferCounter(this.gateID,this.fileID);
}
Program: 55945
Project: 55945
Buggy source:
@Override public void copyToBuffer(final Buffer destinationBuffer) throws IOException {
  if (destinationBuffer.isBackedByMemory()) {
    final long tbr=this.totalBytesRead;
    if (this.fileChannel != null) {
      this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID,false);
    }
    this.totalBytesRead=0;
    destinationBuffer.write(this);
    destinationBuffer.finishWritePhase();
    this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID,false);
    this.fileChannel=null;
    this.totalBytesRead=tbr;
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public void copyToBuffer(final Buffer destinationBuffer) throws IOException {
  if (destinationBuffer.isBackedByMemory()) {
    final long tbr=this.totalBytesRead;
    if (this.fileChannel != null) {
      this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID);
    }
    this.totalBytesRead=0;
    destinationBuffer.write(this);
    destinationBuffer.finishWritePhase();
    if (this.fileChannel != null) {
      this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID);
    }
    this.fileChannel=null;
    this.totalBytesRead=tbr;
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 55946
Project: 55946
Buggy source:
@Override public int read(ByteBuffer dst) throws IOException {
  if (this.writeMode) {
    throw new IOException("String_Node_Str");
  }
  if (this.fileChannel == null) {
    try {
      this.fileChannel=this.fileBufferManager.getFileChannelForReading(this.gateID,this.fileID);
    }
 catch (    InterruptedException e) {
      return -1;
    }
    if (this.fileChannel.position() != this.offset) {
      this.fileChannel.position(this.offset);
    }
  }
  if (this.totalBytesRead >= this.bufferSize) {
    return -1;
  }
  final int rem=remaining();
  int bytesRead;
  if (dst.remaining() > rem) {
    final int excess=dst.remaining() - rem;
    dst.limit(dst.limit() - excess);
    bytesRead=this.fileChannel.read(dst);
    dst.limit(dst.limit() + excess);
  }
 else {
    bytesRead=this.fileChannel.read(dst);
  }
  if (bytesRead < 0) {
    return -1;
  }
  this.totalBytesRead+=bytesRead;
  return bytesRead;
}

Fixed version (ground truth):
@Override public int read(ByteBuffer dst) throws IOException {
  if (this.writeMode) {
    throw new IOException("String_Node_Str");
  }
  if (this.fileChannel == null) {
    try {
      this.fileChannel=this.fileBufferManager.getFileChannelForReading(this.gateID,this.fileID);
    }
 catch (    InterruptedException e) {
      return -1;
    }
    if (this.fileChannel.position() != (this.offset + this.totalBytesRead)) {
      this.fileChannel.position(this.offset + this.totalBytesRead);
    }
  }
  if (this.totalBytesRead >= this.bufferSize) {
    return -1;
  }
  final int rem=remaining();
  int bytesRead;
  if (dst.remaining() > rem) {
    final int excess=dst.remaining() - rem;
    dst.limit(dst.limit() - excess);
    bytesRead=this.fileChannel.read(dst);
    dst.limit(dst.limit() + excess);
  }
 else {
    bytesRead=this.fileChannel.read(dst);
  }
  if (bytesRead < 0) {
    return -1;
  }
  this.totalBytesRead+=bytesRead;
  return bytesRead;
}
Program: 55947
Project: 55947
Buggy source:
@Override public void finishWritePhase() throws IOException {
  if (this.writeMode) {
    final long currentFileSize=this.offset + this.totalBytesWritten;
    this.fileChannel=null;
    this.bufferSize=this.totalBytesWritten;
    this.writeMode=false;
    this.fileID=this.fileBufferManager.reportEndOfWritePhase(this.gateID,currentFileSize);
  }
}

Fixed version (ground truth):
@Override public void finishWritePhase() throws IOException {
  if (this.writeMode) {
    final long currentFileSize=this.offset + this.totalBytesWritten;
    if (this.fileChannel != null) {
      this.fileChannel.position(currentFileSize);
    }
    this.fileChannel=null;
    this.bufferSize=this.totalBytesWritten;
    this.writeMode=false;
    this.fileID=this.fileBufferManager.reportEndOfWritePhase(this.gateID,currentFileSize);
  }
}
Program: 55948
Project: 55948
Buggy source:
@Override public void recycleBuffer(){
  this.fileBufferManager.reportFileBufferAsConsumed(this.gateID,this.fileID);
}

Fixed version (ground truth):
@Override public void recycleBuffer(){
  this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID,true);
}
Program: 55949
Project: 55949
Buggy source:
@Override public void copyToBuffer(final Buffer destinationBuffer) throws IOException {
  if (destinationBuffer.isBackedByMemory()) {
    destinationBuffer.write(this);
    destinationBuffer.finishWritePhase();
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public void copyToBuffer(final Buffer destinationBuffer) throws IOException {
  if (destinationBuffer.isBackedByMemory()) {
    final long tbr=this.totalBytesRead;
    if (this.fileChannel != null) {
      this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID,false);
    }
    this.totalBytesRead=0;
    destinationBuffer.write(this);
    destinationBuffer.finishWritePhase();
    this.fileBufferManager.releaseFileChannelForReading(this.gateID,this.fileID,false);
    this.fileChannel=null;
    this.totalBytesRead=tbr;
    return;
  }
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 55950
Project: 55950
Buggy source:
/** 
 * Returns the lock for a file channel of a   {@link WritableSpillingFile}.
 * @param gateID the ID of the gate the lock has been acquired for
 * @param currentFileSize the size of the file after the last write operation using the locked file channel
 * @throws IOException thrown if the lock could not be released
 */
public FileID reportEndOfWritePhase(final GateID gateID,final long currentFileSize) throws IOException {
  WritableSpillingFile writableSpillingFile=null;
  boolean removed=false;
synchronized (this.writableSpillingFileMap) {
    writableSpillingFile=this.writableSpillingFileMap.get(gateID);
    if (writableSpillingFile == null) {
      throw new IOException("String_Node_Str" + gateID);
    }
    writableSpillingFile.unlockWritableFileChannel(currentFileSize);
    if (writableSpillingFile.isReadRequested() && writableSpillingFile.isSafeToClose()) {
      this.writableSpillingFileMap.remove(gateID);
      removed=true;
    }
  }
  if (removed) {
    writableSpillingFile.close();
    Map<FileID,ReadableSpillingFile> map=null;
synchronized (this.readableSpillingFileMap) {
      map=this.readableSpillingFileMap.get(gateID);
      if (map == null) {
        map=new HashMap<FileID,ReadableSpillingFile>();
        this.readableSpillingFileMap.put(gateID,map);
      }
    }
synchronized (map) {
      map.put(writableSpillingFile.getFileID(),new ReadableSpillingFile(writableSpillingFile.getPhysicalFile()));
      map.notify();
    }
  }
  return writableSpillingFile.getFileID();
}

Fixed version (ground truth):
/** 
 * Returns the lock for a file channel of a   {@link WritableSpillingFile}.
 * @param gateID the ID of the gate the lock has been acquired for
 * @param currentFileSize the size of the file after the last write operation using the locked file channel
 * @throws IOException thrown if the lock could not be released
 */
public FileID reportEndOfWritePhase(final GateID gateID,final long currentFileSize) throws IOException {
  WritableSpillingFile writableSpillingFile=null;
  boolean removed=false;
synchronized (this.writableSpillingFileMap) {
    writableSpillingFile=this.writableSpillingFileMap.get(gateID);
    if (writableSpillingFile == null) {
      throw new IOException("String_Node_Str" + gateID);
    }
    writableSpillingFile.unlockWritableFileChannel(currentFileSize);
    if (writableSpillingFile.isReadRequested() && writableSpillingFile.isSafeToClose()) {
      this.writableSpillingFileMap.remove(gateID);
      removed=true;
    }
  }
  if (removed) {
    writableSpillingFile.close();
    Map<FileID,ReadableSpillingFile> map=null;
synchronized (this.readableSpillingFileMap) {
      map=this.readableSpillingFileMap.get(gateID);
      if (map == null) {
        map=new HashMap<FileID,ReadableSpillingFile>();
        this.readableSpillingFileMap.put(gateID,map);
      }
    }
synchronized (map) {
      map.put(writableSpillingFile.getFileID(),writableSpillingFile.toReadableSpillingFile());
      map.notify();
    }
  }
  return writableSpillingFile.getFileID();
}
Program: 55951
Project: 55951
Buggy source:
private ReadableSpillingFile getReadableSpillingFile(final GateID gateID,final FileID fileID) throws IOException, InterruptedException {
  if (gateID == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (fileID == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  Map<FileID,ReadableSpillingFile> map=null;
synchronized (this.readableSpillingFileMap) {
    map=this.readableSpillingFileMap.get(gateID);
    if (map == null) {
      map=new HashMap<FileID,ReadableSpillingFile>();
      this.readableSpillingFileMap.put(gateID,map);
    }
  }
synchronized (map) {
    while (!map.containsKey(fileID)) {
synchronized (this.writableSpillingFileMap) {
        WritableSpillingFile writableSpillingFile=this.writableSpillingFileMap.get(gateID);
        if (writableSpillingFile != null) {
          writableSpillingFile.requestReadAccess();
          if (writableSpillingFile.isSafeToClose()) {
            writableSpillingFile.close();
            this.writableSpillingFileMap.remove(gateID);
            map.put(writableSpillingFile.getFileID(),new ReadableSpillingFile(writableSpillingFile.getPhysicalFile()));
          }
        }
      }
      if (!map.containsKey(fileID)) {
        map.wait(WritableSpillingFile.MAXIMUM_TIME_WITHOUT_WRITE_ACCESS);
      }
    }
    return map.get(fileID);
  }
}

Fixed version (ground truth):
private ReadableSpillingFile getReadableSpillingFile(final GateID gateID,final FileID fileID) throws IOException, InterruptedException {
  if (gateID == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (fileID == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  Map<FileID,ReadableSpillingFile> map=null;
synchronized (this.readableSpillingFileMap) {
    map=this.readableSpillingFileMap.get(gateID);
    if (map == null) {
      map=new HashMap<FileID,ReadableSpillingFile>();
      this.readableSpillingFileMap.put(gateID,map);
    }
  }
synchronized (map) {
    while (!map.containsKey(fileID)) {
synchronized (this.writableSpillingFileMap) {
        WritableSpillingFile writableSpillingFile=this.writableSpillingFileMap.get(gateID);
        if (writableSpillingFile != null) {
          writableSpillingFile.requestReadAccess();
          if (writableSpillingFile.isSafeToClose()) {
            writableSpillingFile.close();
            this.writableSpillingFileMap.remove(gateID);
            map.put(writableSpillingFile.getFileID(),writableSpillingFile.toReadableSpillingFile());
          }
        }
      }
      if (!map.containsKey(fileID)) {
        map.wait(WritableSpillingFile.MAXIMUM_TIME_WITHOUT_WRITE_ACCESS);
      }
    }
    return map.get(fileID);
  }
}
Program: 55952
Project: 55952
Buggy source:
public void increaseFileCounter(final GateID gateID,final FileID fileID) throws IOException, InterruptedException {
  getReadableSpillingFile(gateID,fileID).increaseLeaseCounter();
}

Fixed version (ground truth):
public void increaseFileCounter(final GateID gateID,final FileID fileID) throws IOException, InterruptedException {
  getReadableSpillingFile(gateID,fileID).increaseNumberOfBuffers();
}
Program: 55953
Project: 55953
Buggy source:
public synchronized boolean checkForEndOfFile() throws IOException {
  --this.leaseCounter;
  if (this.leaseCounter == 0) {
    this.readableFileChannel.close();
    this.physicalFile.delete();
    return true;
  }
  return false;
}

Fixed version (ground truth):
public synchronized boolean checkForEndOfFile() throws IOException {
  --this.numberOfBuffers;
  if (this.numberOfBuffers == 0) {
    this.readableFileChannel.close();
    this.physicalFile.delete();
    return true;
  }
  return false;
}
Program: 55954
Project: 55954
Buggy source:
public ReadableSpillingFile(final File physicalFile) throws IOException {
  this.physicalFile=physicalFile;
  this.readableFileChannel=new FileInputStream(this.physicalFile).getChannel();
}

Fixed version (ground truth):
public ReadableSpillingFile(final File physicalFile,int numberOfBuffers) throws IOException {
  this.physicalFile=physicalFile;
  this.numberOfBuffers=numberOfBuffers;
  this.readableFileChannel=new FileInputStream(this.physicalFile).getChannel();
}
Program: 55955
Project: 55955
Buggy source:
/** 
 * Releases the lock on the spilling file's   {@link WritableByteChannel}.
 * @param currentFileSize the current size of the spilling file in bytes
 */
void unlockWritableFileChannel(final long currentFileSize){
  this.writableChannelLocked=false;
  this.currentFileSize=currentFileSize;
  this.lastUnlockTime=System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * Releases the lock on the spilling file's   {@link WritableByteChannel}.
 * @param currentFileSize the current size of the spilling file in bytes
 */
void unlockWritableFileChannel(final long currentFileSize){
  this.writableChannelLocked=false;
  this.currentFileSize=currentFileSize;
  this.lastUnlockTime=System.currentTimeMillis();
  ++this.numberOfBuffers;
}
Program: 55956
Project: 55956
Buggy source:
public void releaseFileChannelForReading(final GateID gateID,final FileID fileID,boolean deleteFile){
  try {
    Map<FileID,ReadableSpillingFile> map=null;
synchronized (this.readableSpillingFileMap) {
      map=this.readableSpillingFileMap.get(gateID);
      if (map == null) {
        if (this.canceledChannels.contains(gateID)) {
          return;
        }
 else {
          throw new IOException("String_Node_Str" + gateID);
        }
      }
      ReadableSpillingFile readableSpillingFile=null;
synchronized (map) {
        readableSpillingFile=map.get(fileID);
        if (readableSpillingFile == null) {
          if (this.canceledChannels.contains(gateID)) {
            return;
          }
 else {
            throw new IOException("String_Node_Str" + gateID);
          }
        }
        try {
          readableSpillingFile.unlockReadableFileChannel();
          if (deleteFile) {
            if (readableSpillingFile.checkForEndOfFile()) {
              map.remove(fileID);
              if (map.isEmpty()) {
                this.readableSpillingFileMap.remove(gateID);
              }
            }
          }
        }
 catch (        ClosedChannelException e) {
          if (this.canceledChannels.contains(gateID)) {
            readableSpillingFile.getPhysicalFile().delete();
          }
 else {
            throw e;
          }
        }
      }
    }
  }
 catch (  IOException ioe) {
    LOG.error(StringUtils.stringifyException(ioe));
  }
}

Fixed version (ground truth):
public void releaseFileChannelForReading(final GateID gateID,final FileID fileID){
  try {
    getReadableSpillingFile(gateID,fileID).unlockReadableFileChannel();
  }
 catch (  Exception e) {
    LOG.error(StringUtils.stringifyException(e));
  }
}
Program: 55958
Project: 55958
Buggy source:
/** 
 * Entry point for the program.
 * @param args arguments from the command line
 */
@SuppressWarnings("String_Node_Str") public static void main(String[] args){
  Option configDirOpt=OptionBuilder.withArgName("String_Node_Str").hasArg().withDescription("String_Node_Str").create("String_Node_Str");
  Options options=new Options();
  options.addOption(configDirOpt);
  CommandLineParser parser=new GnuParser();
  CommandLine line=null;
  try {
    line=parser.parse(options,args);
  }
 catch (  ParseException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    System.exit(FAILURERETURNCODE);
  }
  String configDir=line.getOptionValue(configDirOpt.getOpt(),null);
  TaskManager taskManager=null;
  try {
    taskManager=new TaskManager(configDir);
  }
 catch (  Throwable t) {
    LOG.fatal("String_Node_Str" + t.getMessage());
    LOG.error(System.err);
    System.exit(FAILURERETURNCODE);
  }
  taskManager.runIOLoop();
  taskManager.shutdown();
}

Fixed version (ground truth):
/** 
 * Entry point for the program.
 * @param args arguments from the command line
 */
@SuppressWarnings("String_Node_Str") public static void main(String[] args){
  Option configDirOpt=OptionBuilder.withArgName("String_Node_Str").hasArg().withDescription("String_Node_Str").create("String_Node_Str");
  Options options=new Options();
  options.addOption(configDirOpt);
  CommandLineParser parser=new GnuParser();
  CommandLine line=null;
  try {
    line=parser.parse(options,args);
  }
 catch (  ParseException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    System.exit(FAILURERETURNCODE);
  }
  String configDir=line.getOptionValue(configDirOpt.getOpt(),null);
  TaskManager taskManager=null;
  try {
    taskManager=new TaskManager(configDir);
  }
 catch (  Throwable t) {
    LOG.fatal("String_Node_Str" + t.getMessage());
    System.exit(FAILURERETURNCODE);
  }
  taskManager.runIOLoop();
  taskManager.shutdown();
}
Program: 55959
Project: 55959
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void releaseWriteBuffers() throws IOException, InterruptedException {
  if (this.outgoingTransferEnvelope == null) {
    LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID());
    return;
  }
  if (this.outgoingTransferEnvelope.getBuffer() == null) {
    LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID() + "String_Node_Str");
    return;
  }
  try {
    this.outgoingTransferEnvelope.getBuffer().finishWritePhase();
  }
 catch (  final IOException ioe) {
    this.byteBufferedOutputChannel.reportIOException(ioe);
  }
  if (!this.isReceiverRunning) {
    final Buffer memBuffer=this.outgoingTransferEnvelope.getBuffer();
    final Buffer fileBuffer=this.outputGateContext.getFileBuffer(memBuffer.size());
    memBuffer.copyToBuffer(fileBuffer);
    this.outgoingTransferEnvelope.setBuffer(fileBuffer);
    this.queuedOutgoingEnvelopes.add(this.outgoingTransferEnvelope);
    memBuffer.recycleBuffer();
    return;
  }
  while (!this.queuedOutgoingEnvelopes.isEmpty()) {
    this.outputGateContext.processEnvelope(this.queuedOutgoingEnvelopes.poll());
  }
  this.outputGateContext.processEnvelope(this.outgoingTransferEnvelope);
  this.outgoingTransferEnvelope=null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void releaseWriteBuffers() throws IOException, InterruptedException {
  if (this.outgoingTransferEnvelope == null) {
    LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID());
    return;
  }
  if (this.outgoingTransferEnvelope.getBuffer() == null) {
    LOG.error("String_Node_Str" + this.byteBufferedOutputChannel.getID() + "String_Node_Str");
    return;
  }
  try {
    this.outgoingTransferEnvelope.getBuffer().finishWritePhase();
  }
 catch (  final IOException ioe) {
    this.byteBufferedOutputChannel.reportIOException(ioe);
  }
  if (!this.isReceiverRunning) {
    final Buffer memBuffer=this.outgoingTransferEnvelope.getBuffer();
    final Buffer fileBuffer=this.outputGateContext.getFileBuffer(memBuffer.size());
    memBuffer.copyToBuffer(fileBuffer);
    this.outgoingTransferEnvelope.setBuffer(fileBuffer);
    this.queuedOutgoingEnvelopes.add(this.outgoingTransferEnvelope);
    this.outgoingTransferEnvelope=null;
    memBuffer.recycleBuffer();
    return;
  }
  while (!this.queuedOutgoingEnvelopes.isEmpty()) {
    this.outputGateContext.processEnvelope(this.queuedOutgoingEnvelopes.poll());
  }
  this.outputGateContext.processEnvelope(this.outgoingTransferEnvelope);
  this.outgoingTransferEnvelope=null;
}
Program: 55960
Project: 55960
Buggy source:
/** 
 * Sets the designated number of buffers for this local buffer cache.
 * @param designatedNumberOfBuffers the designated number of buffers for this local buffer cache
 */
public void setDesignatedNumberOfBuffers(final int designatedNumberOfBuffers){
synchronized (this.buffers) {
    this.designatedNumberOfBuffers=designatedNumberOfBuffers;
    this.buffers.notify();
  }
}

Fixed version (ground truth):
/** 
 * Sets the designated number of buffers for this local buffer cache.
 * @param designatedNumberOfBuffers the designated number of buffers for this local buffer cache
 */
public void setDesignatedNumberOfBuffers(final int designatedNumberOfBuffers){
synchronized (this.buffers) {
    this.designatedNumberOfBuffers=designatedNumberOfBuffers;
    while (this.designatedNumberOfBuffers > this.requestedNumberOfBuffers) {
      if (this.buffers.isEmpty()) {
        break;
      }
      this.globalBufferPool.releaseGlobalBuffer(this.buffers.poll());
      this.requestedNumberOfBuffers--;
    }
    this.buffers.notify();
  }
}
Program: 55961
Project: 55961
Buggy source:
public LocalBufferCache(final int designatedNumberOfBuffers){
  this.globalBufferPool=GlobalBufferPool.getInstance();
  this.maximumBufferSize=this.globalBufferPool.getMaximumBufferSize();
  this.designatedNumberOfBuffers=designatedNumberOfBuffers;
}

Fixed version (ground truth):
public LocalBufferCache(final int designatedNumberOfBuffers,final boolean isShared){
  this.globalBufferPool=GlobalBufferPool.getInstance();
  this.maximumBufferSize=this.globalBufferPool.getMaximumBufferSize();
  this.designatedNumberOfBuffers=designatedNumberOfBuffers;
  this.isShared=isShared;
}
Program: 55962
Project: 55962
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean isShared(){
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean isShared(){
  return this.isShared;
}
Program: 55964
Project: 55964
Buggy source:
public ByteBufferedChannelManager(ChannelLookupProtocol channelLookupService,InstanceConnectionInfo localInstanceConnectionInfo) throws IOException {
  this.channelLookupService=channelLookupService;
  this.localConnectionInfo=localInstanceConnectionInfo;
  this.canceledChannelSet=new CanceledChannelSet();
  this.fileBufferManager=new FileBufferManager(this.canceledChannelSet);
  GlobalBufferPool.getInstance();
  this.transitBufferPool=TransitBufferPool.getInstance();
  this.networkConnectionManager=new NetworkConnectionManager(this,localInstanceConnectionInfo.getAddress(),localInstanceConnectionInfo.getDataPort());
}

Fixed version (ground truth):
public ByteBufferedChannelManager(ChannelLookupProtocol channelLookupService,InstanceConnectionInfo localInstanceConnectionInfo) throws IOException {
  this.channelLookupService=channelLookupService;
  this.localConnectionInfo=localInstanceConnectionInfo;
  this.canceledChannelSet=new CanceledChannelSet();
  this.fileBufferManager=new FileBufferManager(this.canceledChannelSet);
  GlobalBufferPool.getInstance();
  this.transitBufferPool=new LocalBufferCache(128,true);
  this.networkConnectionManager=new NetworkConnectionManager(this,localInstanceConnectionInfo.getAddress(),localInstanceConnectionInfo.getDataPort());
}
Program: 55965
Project: 55965
Buggy source:
private void redistributeGlobalBuffers(){
  final int totalNumberOfBuffers=GlobalBufferPool.getInstance().getTotalNumberOfBuffers();
synchronized (this.taskMap) {
    if (this.taskMap.isEmpty()) {
      return;
    }
    final int buffersPerTask=(int)Math.ceil((double)totalNumberOfBuffers / (double)this.taskMap.size());
    System.out.println("String_Node_Str" + buffersPerTask);
    final Iterator<TaskContext> it=this.taskMap.values().iterator();
    while (it.hasNext()) {
      it.next().setBufferLimit(buffersPerTask);
    }
  }
}

Fixed version (ground truth):
private void redistributeGlobalBuffers(){
  final int totalNumberOfBuffers=GlobalBufferPool.getInstance().getTotalNumberOfBuffers();
synchronized (this.taskMap) {
    if (this.taskMap.isEmpty()) {
      return;
    }
    final int numberOfTasks=this.taskMap.size() + (this.multicastEnabled ? 1 : 0);
    final int buffersPerTask=(int)Math.ceil((double)totalNumberOfBuffers / (double)numberOfTasks);
    System.out.println("String_Node_Str" + buffersPerTask);
    final Iterator<TaskContext> it=this.taskMap.values().iterator();
    while (it.hasNext()) {
      it.next().setBufferLimit(buffersPerTask);
    }
    if (this.multicastEnabled) {
      this.transitBufferPool.setDesignatedNumberOfBuffers(buffersPerTask);
    }
  }
}
Program: 55966
Project: 55966
Buggy source:
public TaskContext(){
  this.localBufferCache=new LocalBufferCache(1);
}

Fixed version (ground truth):
public TaskContext(){
  this.localBufferCache=new LocalBufferCache(1,false);
}
Program: 55967
Project: 55967
Buggy source:
/** 
 * Submits the job assigned to this job client to the job manager.
 * @return a <code>JobSubmissionResult</code> object encapsulating the results of the job submission
 * @throws IOException thrown in case of submission errors while transmitting the data to the job manager
 */
public JobSubmissionResult submitJob() throws IOException {
synchronized (this.jobSubmitClient) {
    final JobSubmissionResult result=this.jobSubmitClient.submitJob(this.jobGraph);
    if (result.getReturnCode() == ReturnCode.SUCCESS) {
      Runtime.getRuntime().addShutdownHook(this.jobCleanUp);
    }
    return result;
  }
}

Fixed version (ground truth):
/** 
 * Submits the job assigned to this job client to the job manager.
 * @return a <code>JobSubmissionResult</code> object encapsulating the results of the job submission
 * @throws IOException thrown in case of submission errors while transmitting the data to the job manager
 */
public JobSubmissionResult submitJob() throws IOException {
synchronized (this.jobSubmitClient) {
    return this.jobSubmitClient.submitJob(this.jobGraph);
  }
}