nus-yam/ex-repair huggingface dataset:
Program: 88121
Project: 88121
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: 88122
Project: 88122
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: 88123
Project: 88123
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: 88124
Project: 88124
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: 88125
Project: 88125
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: 88126
Project: 88126
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: 88127
Project: 88127
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: 88128
Project: 88128
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: 88129
Project: 88129
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: 88130
Project: 88130
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: 88131
Project: 88131
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: 88132
Project: 88132
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: 88133
Project: 88133
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: 88135
Project: 88135
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: 88136
Project: 88136
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: 88137
Project: 88137
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: 88138
Project: 88138
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: 88139
Project: 88139
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: 88140
Project: 88140
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: 88141
Project: 88141
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: 88142
Project: 88142
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: 88143
Project: 88143
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: 88144
Project: 88144
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: 88145
Project: 88145
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: 88146
Project: 88146
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: 88147
Project: 88147
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean isShared(){
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean isShared(){
  return this.isShared;
}
Program: 88149
Project: 88149
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: 88150
Project: 88150
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: 88151
Project: 88151
Buggy source:
public TaskContext(){
  this.localBufferCache=new LocalBufferCache(1);
}

Fixed version (ground truth):
public TaskContext(){
  this.localBufferCache=new LocalBufferCache(1,false);
}
Program: 88153
Project: 88153
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: 88154
Project: 88154
Buggy source:
/** 
 * {@inheritDoc}
 */
public void write(DataOutput out) throws IOException {
  super.write(out);
  out.writeInt(this.getNumberOfOutputChannels());
  for (int i=0; i < getNumberOfOutputChannels(); i++) {
    getOutputChannel(i).getID().write(out);
    EnumUtils.writeEnum(out,getOutputChannel(i).getCompressionLevel());
    StringRecord.writeString(out,getOutputChannel(i).getClass().getName());
    getOutputChannel(i).write(out);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void write(DataOutput out) throws IOException {
  super.write(out);
  out.writeInt(this.getNumberOfOutputChannels());
  for (int i=0; i < getNumberOfOutputChannels(); i++) {
    EnumUtils.writeEnum(out,getOutputChannel(i).getType());
    if (getOutputChannel(i).getType() == ChannelType.NETWORK) {
      out.writeBoolean(getOutputChannel(i).followsPushModel());
    }
    getOutputChannel(i).getID().write(out);
    EnumUtils.writeEnum(out,getOutputChannel(i).getCompressionLevel());
    StringRecord.writeString(out,getOutputChannel(i).getClass().getName());
    getOutputChannel(i).write(out);
  }
}
Program: 88156
Project: 88156
Buggy source:
/** 
 * Creates a new output channel object.
 * @param outputGate the output gate this channel is connected to.
 * @param channelIndex the channel's index at the associated output gate
 * @param channelID the channel ID to assign to the new channel, <code>null</code> to generate a new ID
 * @param compressionLevel the level of compression to be used for this channel
 */
public AbstractOutputChannel(OutputGate<T> outputGate,int channelIndex,ChannelID channelID,CompressionLevel compressionLevel){
  super(channelIndex,channelID,compressionLevel);
  this.outputGate=outputGate;
}

Fixed version (ground truth):
/** 
 * Creates a new output channel object.
 * @param outputGate the output gate this channel is connected to.
 * @param channelIndex the channel's index at the associated output gate
 * @param channelID the channel ID to assign to the new channel, <code>null</code> to generate a new ID
 * @param compressionLevel the level of compression to be used for this channel
 */
public AbstractOutputChannel(OutputGate<T> outputGate,int channelIndex,ChannelID channelID,CompressionLevel compressionLevel,boolean followsPushModel){
  super(channelIndex,channelID,compressionLevel);
  this.outputGate=outputGate;
  this.followsPushModel=followsPushModel;
}
Program: 88157
Project: 88157
Buggy source:
/** 
 * Creates a new byte buffered output channel.
 * @param outputGate the output gate this channel is wired to
 * @param channelIndex the channel's index at the associated output gate
 * @param channelID the channel ID to assign to the new channel, <code>null</code> to generate a new ID
 * @param compressionLevel the level of compression to be used for this channel
 */
public AbstractByteBufferedOutputChannel(OutputGate<T> outputGate,int channelIndex,ChannelID channelID,CompressionLevel compressionLevel,boolean followsPushModel){
  super(outputGate,channelIndex,channelID,compressionLevel);
  this.compressor=CompressionLoader.getCompressorByCompressionLevel(compressionLevel,this);
  this.followsPushModel=followsPushModel;
}

Fixed version (ground truth):
/** 
 * Creates a new byte buffered output channel.
 * @param outputGate the output gate this channel is wired to
 * @param channelIndex the channel's index at the associated output gate
 * @param channelID the channel ID to assign to the new channel, <code>null</code> to generate a new ID
 * @param compressionLevel the level of compression to be used for this channel
 */
public AbstractByteBufferedOutputChannel(OutputGate<T> outputGate,int channelIndex,ChannelID channelID,CompressionLevel compressionLevel,boolean followsPushModel){
  super(outputGate,channelIndex,channelID,compressionLevel,followsPushModel);
  this.compressor=CompressionLoader.getCompressorByCompressionLevel(compressionLevel,this);
}
Program: 88159
Project: 88159
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: 88160
Project: 88160
Buggy source:
/** 
 * Constructs a new broadcast record writer and registers a new output gate with the application's environment.
 * @param inputBase the application that instantiated the record writer
 * @param outputClass the class of records that can be emitted with this record writer
 */
public BroadcastRecordWriter(AbstractInputTask inputBase,Class<T> outputClass){
  super(inputBase,outputClass,null,true);
}

Fixed version (ground truth):
/** 
 * Constructs a new broadcast record writer and registers a new output gate with the application's environment.
 * @param inputBase the application that instantiated the record writer
 * @param outputClass the class of records that can be emitted with this record writer
 */
public BroadcastRecordWriter(AbstractInputTask<?> inputBase,Class<T> outputClass){
  super(inputBase,outputClass,null,true);
}
Program: 88161
Project: 88161
Buggy source:
/** 
 * {@inheritDoc}
 */
@SuppressWarnings("String_Node_Str") public void read(DataInput in) throws IOException {
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@SuppressWarnings("String_Node_Str") public void read(DataInput in) throws IOException {
  super.read(in);
  final int numOutputChannels=in.readInt();
  final Class<?>[] parameters={this.getClass(),int.class,ChannelID.class,CompressionLevel.class};
  for (int i=0; i < numOutputChannels; i++) {
    final ChannelID channelID=new ChannelID();
    channelID.read(in);
    final CompressionLevel compressionLevel=EnumUtils.readEnum(in,CompressionLevel.class);
    final String className=StringRecord.readString(in);
    Class<? extends IOReadableWritable> c=null;
    try {
      c=ClassUtils.getRecordByName(className);
    }
 catch (    ClassNotFoundException e) {
      LOG.error(e);
    }
    if (c == null) {
      throw new IOException("String_Node_Str");
    }
    AbstractOutputChannel<T> eoc=null;
    try {
      final Constructor<AbstractOutputChannel<T>> constructor=(Constructor<AbstractOutputChannel<T>>)c.getDeclaredConstructor(parameters);
      if (constructor == null) {
        throw new IOException("String_Node_Str");
      }
      constructor.setAccessible(true);
      eoc=constructor.newInstance(this,i,channelID,compressionLevel);
    }
 catch (    InstantiationException e) {
      LOG.error(e);
    }
catch (    IllegalArgumentException e) {
      LOG.error(e);
    }
catch (    IllegalAccessException e) {
      LOG.error(e);
    }
catch (    InvocationTargetException e) {
      LOG.error(e);
    }
catch (    SecurityException e) {
      LOG.error(e);
    }
catch (    NoSuchMethodException e) {
      LOG.error(e);
    }
    if (eoc == null) {
      throw new IOException("String_Node_Str");
    }
    eoc.read(in);
    addOutputChannel(eoc);
  }
}
Program: 88162
Project: 88162
Buggy source:
/** 
 * Constructs a new record writer and registers a new output gate with the application's environment.
 * @param inputBase the application that instantiated the record writer
 * @param outputClass the class of records that can be emitted with this record writer
 * @param selector the channel selector to be used to determine the output channel to be used for a record
 */
public RecordWriter(AbstractInputTask inputBase,Class<T> outputClass,ChannelSelector<T> selector){
  super(inputBase,outputClass,selector,false);
}

Fixed version (ground truth):
/** 
 * Constructs a new record writer and registers a new output gate with the application's environment.
 * @param inputBase the application that instantiated the record writer
 * @param outputClass the class of records that can be emitted with this record writer
 * @param selector the channel selector to be used to determine the output channel to be used for a record
 */
public RecordWriter(AbstractInputTask<?> inputBase,Class<T> outputClass,ChannelSelector<T> selector){
  super(inputBase,outputClass,selector,false);
}
Program: 88163
Project: 88163
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);
  }
}
Program: 88164
Project: 88164
Buggy source:
/** 
 * Cancels the job assigned to this job client.
 * @return a <code>JobCancelResult</code> object encapsulating the result of the job cancel request
 * @throws IOException thrown if an error occurred while transmitting the request to the job manager
 */
public JobCancelResult cancelJob() throws IOException {
  Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
synchronized (this.jobSubmitClient) {
    return this.jobSubmitClient.cancelJob(this.jobGraph.getJobID());
  }
}

Fixed version (ground truth):
/** 
 * Cancels the job assigned to this job client.
 * @return a <code>JobCancelResult</code> object encapsulating the result of the job cancel request
 * @throws IOException thrown if an error occurred while transmitting the request to the job manager
 */
public JobCancelResult cancelJob() throws IOException {
synchronized (this.jobSubmitClient) {
    return this.jobSubmitClient.cancelJob(this.jobGraph.getJobID());
  }
}