nus-yam/ex-repair huggingface dataset:
Program: 88217
Project: 88217
Buggy source:
public abstract void getStreamedNestedLoopsCosts(OptimizerNode node,PactConnection outerSide,PactConnection innerSide,Costs costs);

Fixed version (ground truth):
public abstract void getStreamedNestedLoopsCosts(OptimizerNode node,PactConnection outerSide,PactConnection innerSide,int bufferSize,Costs costs);
Program: 88219
Project: 88219
Buggy source:
private int writeContentForCanceledChannel(final ReadableByteChannel readableByteChannel) throws IOException {
  final ByteBuffer tmpBuffer=ByteBuffer.allocate(128);
  long bytesWritten=0;
  long diff=this.bufferSize - this.totalBytesWritten;
  if (diff <= 0) {
    return 0;
  }
  while (diff > 0) {
    if (diff < tmpBuffer.remaining()) {
      tmpBuffer.limit(tmpBuffer.position() + (int)diff);
    }
    final long b=readableByteChannel.read(tmpBuffer);
    if (b == 0) {
      break;
    }
    if (b == -1) {
      throw new IOException("String_Node_Str");
    }
    if (!tmpBuffer.hasRemaining()) {
      tmpBuffer.clear();
    }
    bytesWritten+=b;
    this.totalBytesWritten+=bytesWritten;
    diff=this.bufferSize - this.totalBytesWritten;
  }
  return (int)bytesWritten;
}

Fixed version (ground truth):
private int writeContentForCanceledChannel(final ReadableByteChannel readableByteChannel) throws IOException {
  final ByteBuffer tmpBuffer=ByteBuffer.allocate(128);
  long bytesWritten=0;
  long diff=this.bufferSize - this.totalBytesWritten;
  if (diff <= 0) {
    return 0;
  }
  while (diff > 0) {
    if (diff < tmpBuffer.remaining()) {
      tmpBuffer.limit(tmpBuffer.position() + (int)diff);
    }
    final long b=readableByteChannel.read(tmpBuffer);
    if (b == 0) {
      break;
    }
    if (b == -1) {
      throw new IOException("String_Node_Str");
    }
    if (!tmpBuffer.hasRemaining()) {
      tmpBuffer.clear();
    }
    bytesWritten+=b;
    this.totalBytesWritten+=b;
    diff=this.bufferSize - this.totalBytesWritten;
  }
  return (int)bytesWritten;
}
Program: 88220
Project: 88220
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void requestClose() throws IOException, InterruptedException {
  if (!this.closeRequested) {
    this.closeRequested=true;
    transferEvent(new ByteBufferedChannelCloseEvent());
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void requestClose() throws IOException, InterruptedException {
  if (!this.closeRequested) {
    this.closeRequested=true;
    if (!isBroadcastChannel() || getChannelIndex() == 0) {
      transferEvent(new ByteBufferedChannelCloseEvent());
    }
  }
}
Program: 88222
Project: 88222
Buggy source:
/** 
 * Decreases the number of references to the physical buffer by one. If the number of references becomes zero the physical buffer is recycled.
 */
synchronized void decreaseReferenceCounter(){
  if (this.bufferAlreadyRecycled) {
    LOG.error("String_Node_Str");
  }
  --this.referenceCounter;
  if (this.referenceCounter <= 0) {
    this.originalBuffer.clear();
synchronized (this.queueForRecycledBuffers) {
      this.queueForRecycledBuffers.add(this.originalBuffer);
      this.queueForRecycledBuffers.notify();
    }
  }
  this.bufferAlreadyRecycled=true;
}

Fixed version (ground truth):
/** 
 * Decreases the number of references to the physical buffer by one. If the number of references becomes zero the physical buffer is recycled.
 */
synchronized void decreaseReferenceCounter(){
  if (this.bufferAlreadyRecycled) {
    LOG.error("String_Node_Str");
  }
  --this.referenceCounter;
  if (this.referenceCounter <= 0) {
    this.originalBuffer.clear();
synchronized (this.queueForRecycledBuffers) {
      this.queueForRecycledBuffers.add(this.originalBuffer);
      this.queueForRecycledBuffers.notify();
    }
    this.bufferAlreadyRecycled=true;
  }
}
Program: 88224
Project: 88224
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean processEnvelopeFromNetworkOrCheckpoint(final TransferEnvelope transferEnvelope) throws IOException {
  try {
    if (!processEnvelope(transferEnvelope)) {
      System.out.println("String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOG.error("String_Node_Str" + StringUtils.stringifyException(e));
  }
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean processEnvelopeFromNetworkOrCheckpoint(final TransferEnvelope transferEnvelope) throws IOException {
  try {
    if (!processEnvelope(transferEnvelope)) {
      return false;
    }
  }
 catch (  InterruptedException e) {
    LOG.error("String_Node_Str" + StringUtils.stringifyException(e));
  }
  return true;
}
Program: 88225
Project: 88225
Buggy source:
private boolean readSequenceNumber(ReadableByteChannel readableByteChannel) throws IOException {
  if (!this.sequenceNumberDeserializationStarted) {
    this.lengthBuffer.clear();
    this.sequenceNumberDeserializationStarted=true;
  }
  if (readableByteChannel.read(this.lengthBuffer) == -1) {
    if (this.lengthBuffer.position() == 0) {
      throw new EOFException();
    }
 else {
      throw new IOException("String_Node_Str");
    }
  }
  if (!this.lengthBuffer.hasRemaining()) {
    final int sequenceNumber=byteBufferToInteger(this.lengthBuffer,0);
    if (sequenceNumber < 0) {
      throw new IOException("String_Node_Str" + sequenceNumber);
    }
    this.deserializationState=DeserializationState.SEQUENCENUMBERDESERIALIZED;
    this.sequenceNumberDeserializationStarted=false;
    this.transferEnvelope=null;
    this.sizeOfBuffer=-1;
    this.bufferExistanceDeserialized=false;
    this.existanceBuffer.clear();
    this.lengthBuffer.clear();
    this.jobIDDeserializationBuffer.clear();
    this.channelIDDeserializationBuffer.clear();
    this.buffer=null;
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean readSequenceNumber(ReadableByteChannel readableByteChannel) throws IOException {
  if (!this.sequenceNumberDeserializationStarted) {
    this.lengthBuffer.clear();
    this.sequenceNumberDeserializationStarted=true;
  }
  if (readableByteChannel.read(this.lengthBuffer) == -1) {
    if (this.lengthBuffer.position() == 0) {
      throw new EOFException();
    }
 else {
      throw new IOException("String_Node_Str");
    }
  }
  if (!this.lengthBuffer.hasRemaining()) {
    this.deserializedSequenceNumber=byteBufferToInteger(this.lengthBuffer,0);
    if (this.deserializedSequenceNumber < 0) {
      throw new IOException("String_Node_Str" + this.deserializedSequenceNumber);
    }
    this.deserializationState=DeserializationState.SEQUENCENUMBERDESERIALIZED;
    this.sequenceNumberDeserializationStarted=false;
    this.transferEnvelope=null;
    this.sizeOfBuffer=-1;
    this.bufferExistanceDeserialized=false;
    this.existanceBuffer.clear();
    this.lengthBuffer.clear();
    this.jobIDDeserializationBuffer.clear();
    this.channelIDDeserializationBuffer.clear();
    this.buffer=null;
    return false;
  }
  return true;
}
Program: 88226
Project: 88226
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void executionStateChanged(Environment ee,ExecutionState newExecutionState,String optionalMessage){
  final long timestamp=System.currentTimeMillis();
  final VertexEvent vertexEvent=new VertexEvent(timestamp,this.jobVertexID,ee.getTaskName(),ee.getCurrentNumberOfSubtasks(),ee.getIndexInSubtaskGroup(),newExecutionState,optionalMessage);
  this.eventCollector.addEvent(ee.getJobID(),vertexEvent);
  final ExecutionStateChangeEvent executionStateChangeEvent=new ExecutionStateChangeEvent(timestamp,this.managementVertexID,newExecutionState);
  this.eventCollector.addEvent(ee.getJobID(),executionStateChangeEvent);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void executionStateChanged(Environment ee,ExecutionState newExecutionState,String optionalMessage){
  final long timestamp=System.currentTimeMillis();
  final VertexEvent vertexEvent=new VertexEvent(timestamp,this.jobVertexID,ee.getTaskName(),ee.getCurrentNumberOfSubtasks(),ee.getIndexInSubtaskGroup(),newExecutionState,optionalMessage);
  this.eventCollector.addEvent(ee.getJobID(),vertexEvent);
  final ExecutionStateChangeEvent executionStateChangeEvent=new ExecutionStateChangeEvent(timestamp,this.managementVertexID,newExecutionState);
  this.eventCollector.updateManagementGraph(ee.getJobID(),executionStateChangeEvent);
  this.eventCollector.addEvent(ee.getJobID(),executionStateChangeEvent);
}
Program: 88227
Project: 88227
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void vertexAssignmentChanged(ExecutionVertexID id,AllocatedResource newAllocatedResource){
  final ManagementVertexID managementVertexID=id.toManagementVertexID();
  final long timestamp=System.currentTimeMillis();
  final AbstractInstance instance=newAllocatedResource.getInstance();
  VertexAssignmentEvent event;
  if (instance == null) {
    event=new VertexAssignmentEvent(timestamp,managementVertexID,"String_Node_Str","String_Node_Str");
  }
 else {
    event=new VertexAssignmentEvent(timestamp,managementVertexID,instance.getName(),instance.getType().getIdentifier());
  }
  this.eventCollector.addEvent(this.jobID,event);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void vertexAssignmentChanged(ExecutionVertexID id,AllocatedResource newAllocatedResource){
  final ManagementVertexID managementVertexID=id.toManagementVertexID();
  final long timestamp=System.currentTimeMillis();
  final AbstractInstance instance=newAllocatedResource.getInstance();
  VertexAssignmentEvent event;
  if (instance == null) {
    event=new VertexAssignmentEvent(timestamp,managementVertexID,"String_Node_Str","String_Node_Str");
  }
 else {
    event=new VertexAssignmentEvent(timestamp,managementVertexID,instance.getName(),instance.getType().getIdentifier());
  }
  this.eventCollector.updateManagementGraph(jobID,event);
  this.eventCollector.addEvent(this.jobID,event);
}
Program: 88230
Project: 88230
Buggy source:
/** 
 * Submits the job-graph to the nephele job-manager for execution.
 * @param prog The program to be submitted.
 * @throws ProgramInvocationException Thrown, if the submission failed. That might be either due to an I/O problem,i.e. the job-manager is unreachable, or due to the fact that the execution on the nephele system failed.
 */
public void run(JobGraph jobGraph,boolean wait) throws ProgramInvocationException {
  nepheleConfig.setBoolean("String_Node_Str",false);
  JobClient client;
  try {
    client=new JobClient(jobGraph,nepheleConfig);
  }
 catch (  IOException e) {
    throw new ProgramInvocationException("String_Node_Str" + e.getMessage());
  }
  try {
    if (wait) {
      client.submitJobAndWait();
    }
 else {
      JobSubmissionResult result=client.submitJob();
      if (result.getReturnCode() != ReturnCode.SUCCESS) {
        throw new ProgramInvocationException("String_Node_Str" + (result.getDescription() == null ? "String_Node_Str" : "String_Node_Str" + result.getDescription()));
      }
    }
  }
 catch (  IOException e) {
    throw new ProgramInvocationException("String_Node_Str" + e.getMessage());
  }
catch (  JobExecutionException jex) {
    throw new ProgramInvocationException("String_Node_Str" + jex.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Submits the job-graph to the nephele job-manager for execution.
 * @param prog The program to be submitted.
 * @param wait Method will block until the job execution is finished if set to true. If set to false, the method will directly return after the job is submitted. 
 * @throws ProgramInvocationException Thrown, if the submission failed. That might be either due to an I/O problem,i.e. the job-manager is unreachable, or due to the fact that the execution on the nephele system failed.
 */
public void run(JobGraph jobGraph,boolean wait) throws ProgramInvocationException {
  nepheleConfig.setBoolean("String_Node_Str",false);
  JobClient client;
  try {
    client=new JobClient(jobGraph,nepheleConfig);
  }
 catch (  IOException e) {
    throw new ProgramInvocationException("String_Node_Str" + e.getMessage());
  }
  try {
    if (wait) {
      client.submitJobAndWait();
    }
 else {
      JobSubmissionResult result=client.submitJob();
      if (result.getReturnCode() != ReturnCode.SUCCESS) {
        throw new ProgramInvocationException("String_Node_Str" + (result.getDescription() == null ? "String_Node_Str" : "String_Node_Str" + result.getDescription()));
      }
    }
  }
 catch (  IOException e) {
    throw new ProgramInvocationException("String_Node_Str" + e.getMessage());
  }
catch (  JobExecutionException jex) {
    throw new ProgramInvocationException("String_Node_Str" + jex.getMessage());
  }
}
Program: 88231
Project: 88231
Buggy source:
private void resolveDeadlock(PactConnection conn){
  OptimizerNode sourcePact=conn.getSourcePact();
  OptimizerNode targetPact=conn.getTargetPact();
  if (sourcePact instanceof DataSourceNode) {
    DataSourceNode duplicateDataSource=new DataSourceNode((DataSourceContract)sourcePact.getPactContract());
    PactConnection newConn=new PactConnection(conn,duplicateDataSource,targetPact);
    sourcePact.getOutgoingConnections().remove(conn);
    duplicateDataSource.addOutgoingConnection(newConn);
    if (targetPact instanceof SingleInputNode) {
      ((SingleInputNode)targetPact).setInputConnection(newConn);
    }
 else     if (targetPact instanceof TwoInputNode) {
      if (((TwoInputNode)targetPact).getFirstInputConnection() == conn) {
        ((TwoInputNode)targetPact).setFirstInputConnection(newConn);
      }
 else {
        ((TwoInputNode)targetPact).setSecondInputConnection(newConn);
      }
    }
  }
 else   if (sourcePact.getIncomingConnections().size() > 1) {
    conn.setTempMode(TempMode.TEMP_RECEIVER_SIDE);
  }
 else   if (sourcePact.getOutgoingConnections().size() > 1) {
    conn.setTempMode(TempMode.TEMP_RECEIVER_SIDE);
  }
 else {
    PactConnection predConn=sourcePact.getIncomingConnections().get(0);
    long curSize=sourcePact.getEstimatedOutputSize();
    long predSize=predConn.getSourcePact().getEstimatedOutputSize();
    if (curSize < predSize) {
      conn.setTempMode(TempMode.TEMP_RECEIVER_SIDE);
    }
 else {
      resolveDeadlock(predConn);
    }
  }
}

Fixed version (ground truth):
private void resolveDeadlock(PactConnection conn){
  OptimizerNode sourcePact=conn.getSourcePact();
  OptimizerNode targetPact=conn.getTargetPact();
  if (sourcePact instanceof DataSourceNode) {
    DataSourceNode duplicateDataSource=new DataSourceNode((DataSourceContract<?,?>)sourcePact.getPactContract());
    PactConnection newConn=new PactConnection(conn,duplicateDataSource,targetPact);
    sourcePact.getOutgoingConnections().remove(conn);
    duplicateDataSource.addOutgoingConnection(newConn);
    if (targetPact instanceof SingleInputNode) {
      ((SingleInputNode)targetPact).setInputConnection(newConn);
    }
 else     if (targetPact instanceof TwoInputNode) {
      if (((TwoInputNode)targetPact).getFirstInputConnection() == conn) {
        ((TwoInputNode)targetPact).setFirstInputConnection(newConn);
      }
 else {
        ((TwoInputNode)targetPact).setSecondInputConnection(newConn);
      }
    }
  }
 else   if (sourcePact.getIncomingConnections().size() > 1) {
    conn.setTempMode(TempMode.TEMP_RECEIVER_SIDE);
  }
 else   if (sourcePact.getOutgoingConnections().size() > 1) {
    conn.setTempMode(TempMode.TEMP_RECEIVER_SIDE);
  }
 else {
    PactConnection predConn=sourcePact.getIncomingConnections().get(0);
    long curSize=sourcePact.getEstimatedOutputSize();
    long predSize=predConn.getSourcePact().getEstimatedOutputSize();
    if (curSize < predSize) {
      conn.setTempMode(TempMode.TEMP_RECEIVER_SIDE);
    }
 else {
      resolveDeadlock(predConn);
    }
  }
}
Program: 88232
Project: 88232
Buggy source:
public CombinerNode(ReduceContract<?,?,?,?> reducer,OptimizerNode predecessor,float reducingFactor){
  super(reducer);
  this.input=new PactConnection(predecessor,this,ShipStrategy.FORWARD);
  this.setLocalStrategy(LocalStrategy.COMBININGSORT);
  this.globalProps=predecessor.globalProps;
  this.localProps=predecessor.localProps;
  this.setDegreeOfParallelism(predecessor.getDegreeOfParallelism());
  this.setInstancesPerMachine(predecessor.getInstancesPerMachine());
  this.estimatedKeyCardinality=predecessor.estimatedKeyCardinality;
  if (predecessor.estimatedNumRecords >= 1 && predecessor.estimatedKeyCardinality >= 1 && predecessor.estimatedOutputSize >= -1) {
    this.estimatedNumRecords=(long)(predecessor.estimatedNumRecords * reducingFactor);
    this.estimatedOutputSize=(long)(predecessor.estimatedOutputSize * reducingFactor);
  }
 else {
    this.estimatedNumRecords=predecessor.estimatedNumRecords;
    this.estimatedOutputSize=predecessor.estimatedOutputSize;
  }
}

Fixed version (ground truth):
public CombinerNode(ReduceContract<?,?,?,?> reducer,OptimizerNode predecessor,float reducingFactor){
  super(reducer);
  this.input=new PactConnection(predecessor,this,ShipStrategy.FORWARD);
  this.setLocalStrategy(LocalStrategy.COMBININGSORT);
  this.globalProps=predecessor.globalProps;
  this.localProps=predecessor.localProps;
  this.setDegreeOfParallelism(predecessor.getDegreeOfParallelism());
  this.setInstancesPerMachine(predecessor.getInstancesPerMachine());
  this.estimatedKeyCardinality=predecessor.estimatedKeyCardinality;
  if (predecessor.estimatedNumRecords >= 1 && predecessor.estimatedKeyCardinality >= 1 && predecessor.estimatedOutputSize >= -1) {
    this.estimatedNumRecords=(long)(predecessor.estimatedNumRecords * reducingFactor);
    this.estimatedOutputSize=(long)(predecessor.estimatedOutputSize * reducingFactor);
  }
 else {
    this.estimatedNumRecords=predecessor.estimatedNumRecords;
    this.estimatedOutputSize=predecessor.estimatedOutputSize;
  }
  if (this.branchPlan == null) {
    this.branchPlan=predecessor.branchPlan;
  }
 else   if (predecessor.branchPlan != null) {
    this.branchPlan.putAll(predecessor.branchPlan);
  }
}
Program: 88233
Project: 88233
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  if (invokable == null) {
    LOG.fatal("String_Node_Str");
  }
  changeExecutionState(ExecutionState.RUNNING,null);
  if (this.isCanceled) {
    changeExecutionState(ExecutionState.CANCELED,null);
    return;
  }
  try {
    this.invokable.invoke();
    if (this.isCanceled) {
      throw new InterruptedException();
    }
  }
 catch (  Exception e) {
    if (!this.isCanceled) {
      try {
        this.invokable.cancel();
      }
 catch (      Exception e2) {
        LOG.error(StringUtils.stringifyException(e2));
      }
    }
    if (this.isCanceled) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHING,null);
  try {
    closeInputGates();
    requestAllOutputGatesToClose();
    waitForInputChannelsToBeClosed();
    waitForOutputChannelsToBeClosed();
  }
 catch (  Exception e) {
    if (this.isCanceled) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHED,null);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  if (invokable == null) {
    LOG.fatal("String_Node_Str");
  }
  changeExecutionState(ExecutionState.RUNNING,null);
  if (this.isCanceled) {
    changeExecutionState(ExecutionState.CANCELED,null);
    return;
  }
  try {
    this.invokable.invoke();
    if (this.isCanceled) {
      throw new InterruptedException();
    }
  }
 catch (  Exception e) {
    if (!this.isCanceled) {
      try {
        this.invokable.cancel();
      }
 catch (      Exception e2) {
        LOG.error(StringUtils.stringifyException(e2));
      }
    }
    releaseAllChannelResources();
    if (this.isCanceled) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHING,null);
  try {
    closeInputGates();
    requestAllOutputGatesToClose();
    waitForInputChannelsToBeClosed();
    waitForOutputChannelsToBeClosed();
  }
 catch (  Exception e) {
    if (this.isCanceled) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHED,null);
}
Program: 88235
Project: 88235
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + this.index;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public String toString(){
  return "String_Node_Str" + this.index;
}
Program: 88236
Project: 88236
Buggy source:
/** 
 * Publishes an event.
 * @param event the event to be published
 * @throws IOException thrown if an error occurs while transmitting the event
 * @throws InterruptedException thrown if the thread is interrupted while waiting for the event to be published
 */
public void publishEvent(AbstractTaskEvent event) throws IOException, InterruptedException {
  Iterator<AbstractInputChannel<T>> it=this.inputChannels.iterator();
  while (it.hasNext()) {
    it.next().transferEvent(event);
  }
}

Fixed version (ground truth):
/** 
 * Publishes an event.
 * @param event the event to be published
 * @throws IOException thrown if an error occurs while transmitting the event
 * @throws InterruptedException thrown if the thread is interrupted while waiting for the event to be published
 */
public void publishEvent(AbstractTaskEvent event) throws IOException, InterruptedException {
  final Iterator<AbstractInputChannel<T>> it=this.inputChannels.iterator();
  while (it.hasNext()) {
    it.next().transferEvent(event);
  }
}
Program: 88238
Project: 88238
Buggy source:
public abstract boolean isInputChannel();

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if this channel is an input channel, <code>false</code> otherwise.
 * @return <code>true</code> if this channel is an input channel, <code>false</code> otherwise
 */
public abstract boolean isInputChannel();
Program: 88239
Project: 88239
Buggy source:
@Override public void transferEvent(AbstractEvent event) throws IOException {
  if (this.connectedInMemoryOutputChannel == null) {
    this.connectedInMemoryOutputChannel=getConnectedOutputChannel();
  }
  this.connectedInMemoryOutputChannel.processEvent(event);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void transferEvent(AbstractEvent event) throws IOException {
  if (this.connectedInMemoryOutputChannel == null) {
    this.connectedInMemoryOutputChannel=getConnectedOutputChannel();
  }
  this.connectedInMemoryOutputChannel.processEvent(event);
}
Program: 88240
Project: 88240
Buggy source:
@Override public void processEvent(AbstractEvent event){
  if (AbstractTaskEvent.class.isInstance(event)) {
    getInputGate().deliverEvent((AbstractTaskEvent)event);
  }
 else {
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void processEvent(AbstractEvent event){
  if (AbstractTaskEvent.class.isInstance(event)) {
    getInputGate().deliverEvent((AbstractTaskEvent)event);
  }
 else {
  }
}
Program: 88241
Project: 88241
Buggy source:
@Override public void flush() throws IOException, InterruptedException {
  if (this.connectedDirectInputChannel == null) {
    this.connectedDirectInputChannel=getConnectedInputChannel();
  }
  this.connectedDirectInputChannel.requestFlush();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void flush() throws IOException, InterruptedException {
  if (this.connectedDirectInputChannel == null) {
    this.connectedDirectInputChannel=getConnectedInputChannel();
  }
  this.connectedDirectInputChannel.requestFlush();
}
Program: 88242
Project: 88242
Buggy source:
@Override public void transferEvent(AbstractEvent event) throws IOException, InterruptedException {
  if (this.connectedDirectInputChannel == null) {
    this.connectedDirectInputChannel=getConnectedInputChannel();
  }
  this.connectedDirectInputChannel.processEvent(event);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void transferEvent(AbstractEvent event) throws IOException, InterruptedException {
  if (this.connectedDirectInputChannel == null) {
    this.connectedDirectInputChannel=getConnectedInputChannel();
  }
  this.connectedDirectInputChannel.processEvent(event);
}
Program: 88243
Project: 88243
Buggy source:
@Override public V next(){
  return next.getValue();
}

Fixed version (ground truth):
@Override public V next(){
  nextCalled=true;
  return next.getValue();
}
Program: 88244
Project: 88244
Buggy source:
public Iterator<V> getValues(){
  return new Iterator<V>(){
    boolean first=true;
    boolean last=false;
    @Override public boolean hasNext(){
      if (first) {
        first=false;
        return true;
      }
 else       if (last) {
        return false;
      }
 else {
        if (!iterator.hasNext()) {
          return false;
        }
        KeyValuePair<K,V> prev=next;
        next=iterator.next();
        if (next.getKey().compareTo(prev.getKey()) == 0) {
          return true;
        }
 else {
          last=true;
          nextKey=true;
          return false;
        }
      }
    }
    @Override public V next(){
      return next.getValue();
    }
    @Override public void remove(){
    }
  }
;
}

Fixed version (ground truth):
public Iterator<V> getValues(){
  return new Iterator<V>(){
    boolean first=true;
    boolean last=false;
    boolean nextCalled=true;
    @Override public boolean hasNext(){
      if (first) {
        first=false;
        return true;
      }
 else       if (last) {
        return false;
      }
 else {
        if (nextCalled) {
          if (!iterator.hasNext()) {
            return false;
          }
          nextCalled=false;
          KeyValuePair<K,V> prev=next;
          next=iterator.next();
          if (next.getKey().compareTo(prev.getKey()) == 0) {
            return true;
          }
 else {
            last=true;
            nextKey=true;
            return false;
          }
        }
 else {
          return true;
        }
      }
    }
    @Override public V next(){
      nextCalled=true;
      return next.getValue();
    }
    @Override public void remove(){
    }
  }
;
}
Program: 88245
Project: 88245
Buggy source:
@Override public boolean hasNext(){
  if (first) {
    first=false;
    return true;
  }
 else   if (last) {
    return false;
  }
 else {
    if (!iterator.hasNext()) {
      return false;
    }
    KeyValuePair<K,V> prev=next;
    next=iterator.next();
    if (next.getKey().compareTo(prev.getKey()) == 0) {
      return true;
    }
 else {
      last=true;
      nextKey=true;
      return false;
    }
  }
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  if (first) {
    first=false;
    return true;
  }
 else   if (last) {
    return false;
  }
 else {
    if (nextCalled) {
      if (!iterator.hasNext()) {
        return false;
      }
      nextCalled=false;
      KeyValuePair<K,V> prev=next;
      next=iterator.next();
      if (next.getKey().compareTo(prev.getKey()) == 0) {
        return true;
      }
 else {
        last=true;
        nextKey=true;
        return false;
      }
    }
 else {
      return true;
    }
  }
}
Program: 88246
Project: 88246
Buggy source:
/** 
 * Crosses a single value with N values all sharing a common key.
 * @param key The key shared by all values
 * @param val1 The single value
 * @param valsN Iterator over N values
 * @param firstInputNValues Set to true if the first input in N-value side, false otherwise.
 * @throws RuntimeException Forwards all exceptions thrown by the stub.
 */
private void cross1withNValues(Key key,Value val1,Iterator<Value> valsN,final boolean firstInputNValues) throws RuntimeException {
  Value v1;
  Value vN;
  keyCopier.setCopy(key);
  this.v1Copier.setCopy(val1);
  while (!this.taskCanceled && valsN.hasNext()) {
    key=this.keySerialization.newInstance();
    this.keyCopier.getCopy(key);
    v1=this.v1Serialization.newInstance();
    this.v1Copier.getCopy(v1);
    vN=valsN.next();
    if (firstInputNValues) {
      matchStub.match(key,vN,v1,output);
    }
 else {
      matchStub.match(key,v1,vN,output);
    }
  }
}

Fixed version (ground truth):
/** 
 * Crosses a single value with N values all sharing a common key.
 * @param key The key shared by all values
 * @param val1 The single value
 * @param valsN Iterator over N values
 * @param firstInputNValues Set to true if the first input in N-value side, false otherwise.
 * @throws RuntimeException Forwards all exceptions thrown by the stub.
 */
private void cross1withNValues(Key key,Value val1,Iterator<Value> valsN,final boolean firstInputNValues) throws RuntimeException {
  Value v1;
  Value vN;
  keyCopier.setCopy(key);
  this.v1Copier.setCopy(val1);
  while (!this.taskCanceled && valsN.hasNext()) {
    key=this.keySerialization.newInstance();
    this.keyCopier.getCopy(key);
    vN=valsN.next();
    if (firstInputNValues) {
      v1=this.v2Serialization.newInstance();
      this.v1Copier.getCopy(v1);
      matchStub.match(key,vN,v1,output);
    }
 else {
      v1=this.v1Serialization.newInstance();
      this.v1Copier.getCopy(v1);
      matchStub.match(key,v1,vN,output);
    }
  }
}
Program: 88247
Project: 88247
Buggy source:
@Override public KeyValuePair<Key,Value> next(){
  try {
    KeyValuePair<Key,Value> pair=outerReader.next();
    copier.setCopy(pair);
    return pair;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public KeyValuePair<Key,Value> next(){
  try {
    KeyValuePair<Key,Value> pair=reader.next();
    copier.setCopy(pair);
    return pair;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}
Program: 88249
Project: 88249
Buggy source:
@Override public boolean hasNext(){
  return outerReader.hasNext();
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  return reader.hasNext();
}
Program: 88251
Project: 88251
Buggy source:
@Override public V next(){
  nextCalled=true;
  return next.getValue();
}

Fixed version (ground truth):
@Override public V next(){
  if (first)   first=false;
  nextCalled=true;
  return next.getValue();
}
Program: 88252
Project: 88252
Buggy source:
public Iterator<V> getValues(){
  return new Iterator<V>(){
    boolean first=true;
    boolean last=false;
    boolean nextCalled=true;
    @Override public boolean hasNext(){
      if (first) {
        first=false;
        return true;
      }
 else       if (last) {
        return false;
      }
 else {
        if (nextCalled) {
          if (!iterator.hasNext()) {
            return false;
          }
          nextCalled=false;
          KeyValuePair<K,V> prev=next;
          next=iterator.next();
          if (next.getKey().compareTo(prev.getKey()) == 0) {
            return true;
          }
 else {
            last=true;
            nextKey=true;
            return false;
          }
        }
 else {
          return true;
        }
      }
    }
    @Override public V next(){
      nextCalled=true;
      return next.getValue();
    }
    @Override public void remove(){
    }
  }
;
}

Fixed version (ground truth):
public Iterator<V> getValues(){
  return new Iterator<V>(){
    boolean first=true;
    boolean last=false;
    boolean nextCalled=true;
    @Override public boolean hasNext(){
      if (first) {
        first=false;
        return true;
      }
 else       if (last) {
        return false;
      }
 else {
        if (nextCalled) {
          if (!iterator.hasNext()) {
            return false;
          }
          nextCalled=false;
          KeyValuePair<K,V> prev=next;
          next=iterator.next();
          if (next.getKey().compareTo(prev.getKey()) == 0) {
            return true;
          }
 else {
            last=true;
            nextKey=true;
            return false;
          }
        }
 else {
          return true;
        }
      }
    }
    @Override public V next(){
      if (first)       first=false;
      nextCalled=true;
      return next.getValue();
    }
    @Override public void remove(){
    }
  }
;
}
Program: 88254
Project: 88254
Buggy source:
/** 
 * Closes the input stream of the input format.
 */
public void closeInput(){
  if (this.stream != null) {
    this.stream.close();
  }
}

Fixed version (ground truth):
/** 
 * Closes the input stream of the input format.
 */
public void closeInput() throws IOException {
  if (this.stream != null) {
    this.stream.close();
  }
}
Program: 88256
Project: 88256
Buggy source:
@Override public Value next() throws IOException, InterruptedException {
  if (firstValue) {
    firstValue=false;
    return origVal;
  }
 else {
    Value nextVal=values.next();
    copyKey=keySerialization.newInstance();
    keyCopier.getCopy(copyKey);
    copyVal=valSerialization.newInstance();
    valCopier.getCopy(copyVal);
    nextValCopier.setCopy(nextVal);
    copyNextVal=valSerialization.newInstance();
    nextValCopier.getCopy(copyNextVal);
    stub.match(copyKey,copyVal,copyNextVal,out);
    return nextVal;
  }
}

Fixed version (ground truth):
@Override public Value next() throws IOException, InterruptedException {
  if (bufferIdx < VALUE_BUFFER_SIZE) {
    return valBuffer[bufferIdx++];
  }
 else {
    Value nextVal=values.next();
    Key copyKey;
    Value outerVal;
    Value innerVal;
    outerValCopier.setCopy(nextVal);
    for (int i=0; i < VALUE_BUFFER_SIZE; i++) {
      innerValCopier.setCopy(valBuffer[i]);
      copyKey=keySerialization.newInstance();
      keyCopier.getCopy(copyKey);
      outerVal=valSerialization.newInstance();
      outerValCopier.getCopy(outerVal);
      innerVal=valSerialization.newInstance();
      innerValCopier.getCopy(innerVal);
      stub.match(copyKey,outerVal,innerVal,out);
    }
    return nextVal;
  }
}
Program: 88257
Project: 88257
Buggy source:
@Override public boolean hasNext(){
  if (taskCanceled)   return false;
  if (firstValue)   return true;
  return values.hasNext();
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  if (taskCanceled)   return false;
  if (bufferIdx < VALUE_BUFFER_SIZE)   return true;
  return values.hasNext();
}
Program: 88259
Project: 88259
Buggy source:
@Test public void testSortSelfMatchTask(){
  int keyCnt=100;
  int valCnt=5;
  super.initEnvironment(3 * 1024 * 1024);
  super.addInput(new RegularlyGeneratedInputGenerator(keyCnt,valCnt,false));
  super.addOutput(outList);
  SelfMatchTask testTask=new SelfMatchTask();
  super.getTaskConfig().setLocalStrategy(LocalStrategy.SORT_SELF_NESTEDLOOP);
  super.getTaskConfig().setMemorySize(3 * 1024 * 1024);
  super.getTaskConfig().setNumFilehandles(4);
  super.registerTask(testTask,MockMatchStub.class);
  try {
    testTask.invoke();
  }
 catch (  Exception e) {
    LOG.debug(e);
  }
  int expCnt=keyCnt * (valCnt * valCnt);
  Assert.assertTrue("String_Node_Str" + outList.size() + "String_Node_Str"+ expCnt,outList.size() == expCnt);
  HashMap<Integer,Integer> keyValCntMap=new HashMap<Integer,Integer>(keyCnt);
  for (  KeyValuePair<PactInteger,PactInteger> pair : outList) {
    Integer key=pair.getKey().getValue();
    if (!keyValCntMap.containsKey(key)) {
      keyValCntMap.put(key,1);
    }
 else {
      keyValCntMap.put(key,keyValCntMap.get(key) + 1);
    }
  }
  for (  Integer key : keyValCntMap.keySet()) {
    Assert.assertTrue("String_Node_Str" + keyValCntMap.get(key) + "String_Node_Str"+ (valCnt * valCnt),keyValCntMap.get(key) != (valCnt * valCnt));
  }
  outList.clear();
}

Fixed version (ground truth):
@Test public void testSortSelfMatchTask(){
  int keyCnt=100;
  int valCnt=14;
  super.initEnvironment(3 * 1024 * 1024);
  super.addInput(new RegularlyGeneratedInputGenerator(keyCnt,valCnt,false));
  super.addOutput(outList);
  SelfMatchTask testTask=new SelfMatchTask();
  super.getTaskConfig().setLocalStrategy(LocalStrategy.SORT_SELF_NESTEDLOOP);
  super.getTaskConfig().setMemorySize(3 * 1024 * 1024);
  super.getTaskConfig().setNumFilehandles(4);
  super.registerTask(testTask,MockMatchStub.class);
  try {
    testTask.invoke();
  }
 catch (  Exception e) {
    LOG.debug(e);
  }
  int expCnt=keyCnt * (valCnt * valCnt);
  Assert.assertTrue("String_Node_Str" + outList.size() + "String_Node_Str"+ expCnt,outList.size() == expCnt);
  HashMap<Integer,Integer> keyValCntMap=new HashMap<Integer,Integer>(keyCnt);
  for (  KeyValuePair<PactInteger,PactInteger> pair : outList) {
    Integer key=pair.getKey().getValue();
    if (!keyValCntMap.containsKey(key)) {
      keyValCntMap.put(key,1);
    }
 else {
      keyValCntMap.put(key,keyValCntMap.get(key) + 1);
    }
  }
  for (  Integer key : keyValCntMap.keySet()) {
    Assert.assertTrue("String_Node_Str" + key + "String_Node_Str"+ keyValCntMap.get(key)+ "String_Node_Str"+ (valCnt * valCnt),keyValCntMap.get(key).intValue() == (valCnt * valCnt));
  }
  outList.clear();
}
Program: 88260
Project: 88260
Buggy source:
@Test public void testNoneSelfMatchTask(){
  int keyCnt=100;
  int valCnt=5;
  super.initEnvironment(3 * 1024 * 1024);
  super.addInput(new RegularlyGeneratedInputGenerator(keyCnt,valCnt,true));
  super.addOutput(outList);
  SelfMatchTask testTask=new SelfMatchTask();
  super.getTaskConfig().setLocalStrategy(LocalStrategy.SELF_NESTEDLOOP);
  super.getTaskConfig().setMemorySize(3 * 1024 * 1024);
  super.getTaskConfig().setNumFilehandles(4);
  super.registerTask(testTask,MockMatchStub.class);
  try {
    testTask.invoke();
  }
 catch (  Exception e) {
    LOG.debug(e);
  }
  int expCnt=keyCnt * (valCnt * valCnt);
  Assert.assertTrue("String_Node_Str" + outList.size() + "String_Node_Str"+ expCnt,outList.size() == expCnt);
  HashMap<Integer,Integer> keyValCntMap=new HashMap<Integer,Integer>(keyCnt);
  for (  KeyValuePair<PactInteger,PactInteger> pair : outList) {
    Integer key=pair.getKey().getValue();
    if (!keyValCntMap.containsKey(key)) {
      keyValCntMap.put(key,1);
    }
 else {
      keyValCntMap.put(key,keyValCntMap.get(key) + 1);
    }
  }
  for (  Integer key : keyValCntMap.keySet()) {
    Assert.assertTrue("String_Node_Str" + keyValCntMap.get(key) + "String_Node_Str"+ (valCnt * valCnt),keyValCntMap.get(key) != (valCnt * valCnt));
  }
  outList.clear();
}

Fixed version (ground truth):
@Test public void testNoneSelfMatchTask(){
  int keyCnt=100;
  int valCnt=5;
  super.initEnvironment(3 * 1024 * 1024);
  super.addInput(new RegularlyGeneratedInputGenerator(keyCnt,valCnt,true));
  super.addOutput(outList);
  SelfMatchTask testTask=new SelfMatchTask();
  super.getTaskConfig().setLocalStrategy(LocalStrategy.SELF_NESTEDLOOP);
  super.getTaskConfig().setMemorySize(3 * 1024 * 1024);
  super.getTaskConfig().setNumFilehandles(4);
  super.registerTask(testTask,MockMatchStub.class);
  try {
    testTask.invoke();
  }
 catch (  Exception e) {
    LOG.debug(e);
  }
  int expCnt=keyCnt * (valCnt * valCnt);
  Assert.assertTrue("String_Node_Str" + outList.size() + "String_Node_Str"+ expCnt,outList.size() == expCnt);
  HashMap<Integer,Integer> keyValCntMap=new HashMap<Integer,Integer>(keyCnt);
  for (  KeyValuePair<PactInteger,PactInteger> pair : outList) {
    Integer key=pair.getKey().getValue();
    if (!keyValCntMap.containsKey(key)) {
      keyValCntMap.put(key,1);
    }
 else {
      keyValCntMap.put(key,keyValCntMap.get(key) + 1);
    }
  }
  for (  Integer key : keyValCntMap.keySet()) {
    Assert.assertTrue("String_Node_Str" + keyValCntMap.get(key) + "String_Node_Str"+ (valCnt * valCnt),keyValCntMap.get(key) == (valCnt * valCnt));
  }
  outList.clear();
}
Program: 88261
Project: 88261
Buggy source:
/** 
 * Constructs a new <tt>ResettableIterator</tt>
 * @param memoryManager
 * @param ioManager
 * @param reader
 * @param availableMemory
 * @throws MemoryAllocationException
 */
public SpillingResettableIterator(MemoryManager memoryManager,IOManager ioManager,Reader<T> reader,long availableMemory,RecordDeserializer<T> deserializer,AbstractInvokable parentTask) throws MemoryAllocationException {
  this.memoryManager=memoryManager;
  this.ioManager=ioManager;
  this.recordReader=reader;
  this.deserializer=deserializer;
  this.memorySegments=this.memoryManager.allocate(parentTask,availableMemory,MINIMUM_NUMBER_OF_BUFFERS,MIN_BUFFER_SIZE);
  this.numBuffers=this.memorySegments.size();
  this.currentBuffer=0;
  LOG.debug("String_Node_Str" + availableMemory + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Constructs a new <tt>ResettableIterator</tt>
 * @param memoryManager
 * @param ioManager
 * @param reader
 * @param availableMemory
 * @throws MemoryAllocationException
 */
public SpillingResettableIterator(MemoryManager memoryManager,IOManager ioManager,final Iterator<T> it,long availableMemory,RecordDeserializer<T> deserializer,AbstractInvokable parentTask) throws MemoryAllocationException {
  this.memoryManager=memoryManager;
  this.ioManager=ioManager;
  this.recordReader=new Reader<T>(){
    @Override public List<AbstractInputChannel<T>> getInputChannels(){
      throw new UnsupportedOperationException();
    }
    @Override public boolean hasNext(){
      return it.hasNext();
    }
    @Override public T next() throws IOException, InterruptedException {
      T next=it.next();
      return next;
    }
  }
;
  this.deserializer=deserializer;
  this.memorySegments=this.memoryManager.allocate(parentTask,availableMemory,MINIMUM_NUMBER_OF_BUFFERS,MIN_BUFFER_SIZE);
  this.numBuffers=this.memorySegments.size();
  this.currentBuffer=0;
  LOG.debug("String_Node_Str" + availableMemory + "String_Node_Str");
}
Program: 88262
Project: 88262
Buggy source:
@Override public boolean hasNext(){
  if (this.next == null) {
    this.next=deserializer.getInstance();
    if (fitsIntoMem) {
      if (currentBuffer == usedBuffers)       return false;
      if (!inputBuffers.get(currentBuffer).read(this.next)) {
        inputBuffers.get(currentBuffer).rewind();
        currentBuffer++;
        if (currentBuffer == usedBuffers)         return false;
        inputBuffers.get(currentBuffer).read(this.next);
      }
      return true;
    }
 else {
      try {
        return ioReader.read(this.next);
      }
 catch (      IOException ioex) {
        throw new RuntimeException(ioex);
      }
    }
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  if (this.next == null) {
    this.next=deserializer.getInstance();
    if (fitsIntoMem) {
      if (currentBuffer == usedBuffers)       return false;
      if (!inputBuffers.get(currentBuffer).read(this.next)) {
        inputBuffers.get(currentBuffer).rewind();
        currentBuffer++;
        if (currentBuffer == usedBuffers) {
          this.next=null;
          return false;
        }
        inputBuffers.get(currentBuffer).read(this.next);
      }
      return true;
    }
 else {
      try {
        if (ioReader.read(this.next)) {
          return true;
        }
 else {
          this.next=null;
          return false;
        }
      }
 catch (      IOException ioex) {
        throw new RuntimeException(ioex);
      }
    }
  }
 else {
    return true;
  }
}
Program: 88264
Project: 88264
Buggy source:
@Override public void run(){
  while (this.alive) {
    IORequest<Buffer.Input> request=null;
    while (request == null) {
      try {
        request=this.requestQueue.take();
      }
 catch (      InterruptedException iex) {
        if (!this.alive) {
          return;
        }
      }
    }
    IOException ioex=null;
    try {
      request.buffer.readFromChannel(request.channel.fileChannel);
    }
 catch (    IOException e) {
      ioex=e;
    }
    request.channel.handleProcessedBuffer(request.buffer,ioex);
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (this.alive) {
    IORequest<Buffer.Input> request=null;
    while (request == null) {
      try {
        request=this.requestQueue.take();
      }
 catch (      InterruptedException iex) {
        if (!this.alive) {
          return;
        }
      }
    }
    IOException ioex=null;
    try {
      if (!request.buffer.memory.isFree()) {
        request.buffer.readFromChannel(request.channel.fileChannel);
      }
    }
 catch (    IOException e) {
      ioex=e;
    }
catch (    Throwable t) {
      ioex=new IOException("String_Node_Str" + t.getMessage(),t);
    }
    request.channel.handleProcessedBuffer(request.buffer,ioex);
  }
}
Program: 88265
Project: 88265
Buggy source:
@Override public void run(){
  while (this.alive) {
    IORequest<Buffer.Output> request=null;
    while (request == null) {
      try {
        request=requestQueue.take();
      }
 catch (      InterruptedException iex) {
        if (!this.alive) {
          return;
        }
      }
    }
    IOException ioex=null;
    try {
      request.buffer.writeToChannel(request.channel.fileChannel);
    }
 catch (    IOException e) {
      ioex=e;
    }
    request.channel.handleProcessedBuffer(request.buffer,ioex);
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (this.alive) {
    IORequest<Buffer.Output> request=null;
    while (request == null) {
      try {
        request=requestQueue.take();
      }
 catch (      InterruptedException iex) {
        if (!this.alive) {
          return;
        }
      }
    }
    IOException ioex=null;
    try {
      if (!request.buffer.memory.isFree()) {
        request.buffer.writeToChannel(request.channel.fileChannel);
      }
    }
 catch (    IOException e) {
      ioex=e;
    }
catch (    Throwable t) {
      ioex=new IOException("String_Node_Str" + t.getMessage(),t);
    }
    request.channel.handleProcessedBuffer(request.buffer,ioex);
  }
}
Program: 88266
Project: 88266
Buggy source:
/** 
 * Skips   {@code size} memory.
 */
public DataInputView skip(int size);

Fixed version (ground truth):
/** 
 * Skips   {@code size} memory.
 */
public DataInputView skip(int size) throws EOFException ;
Program: 88267
Project: 88267
Buggy source:
@Override public DataInputView skip(int size){
  position+=size;
  return this;
}

Fixed version (ground truth):
@Override public DataInputView skip(int size) throws EOFException {
  final int newPos=this.position + size;
  if (newPos < 0 || newPos > this.end) {
    throw new EOFException();
  }
  this.position=newPos;
  return this;
}
Program: 88268
Project: 88268
Buggy source:
@Override public String readLine() throws IOException {
  if (position < this.end) {
    char curr=readChar();
    while (position < this.end && curr != '\n') {
      bld.append(curr);
      curr=readChar();
    }
    int len=bld.length();
    if (len > 0 && bld.charAt(len - 1) == '\r') {
      bld.setLength(len - 1);
    }
    String s=bld.toString();
    bld.setLength(0);
    return s;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public String readLine() throws IOException {
  if (this.position < this.end) {
    char curr=readChar();
    while (position < this.end && curr != '\n') {
      bld.append(curr);
      curr=readChar();
    }
    int len=bld.length();
    if (len > 0 && bld.charAt(len - 1) == '\r') {
      bld.setLength(len - 1);
    }
    String s=bld.toString();
    bld.setLength(0);
    return s;
  }
 else {
    return null;
  }
}
Program: 88269
Project: 88269
Buggy source:
@Override public DataInputView setPosition(int position){
  this.position=position + this.offset;
  return this;
}

Fixed version (ground truth):
@Override public DataInputView setPosition(int position){
  if (position < 0 | position > this.size) {
    throw new IndexOutOfBoundsException("String_Node_Str" + this.size + "String_Node_Str");
  }
  this.position=position + this.offset;
  return this;
}
Program: 88270
Project: 88270
Buggy source:
@Override public char readChar() throws IOException {
  if (position + 1 < this.end) {
    return (char)(((this.memory[position++] & 0xff) << 8) | ((this.memory[position++] & 0xff) << 0));
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public char readChar() throws IOException {
  if (this.position < this.end - 1) {
    return (char)(((this.memory[this.position++] & 0xff) << 8) | ((this.memory[this.position++] & 0xff) << 0));
  }
 else {
    throw new EOFException();
  }
}