nus-yam/ex-repair huggingface dataset:
Program: 56066
Project: 56066
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: 56067
Project: 56067
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: 56068
Project: 56068
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: 56069
Project: 56069
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: 56070
Project: 56070
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();
  }
}
Program: 56071
Project: 56071
Buggy source:
@Override public int skipBytes(int n) throws IOException {
  if (position + n <= this.end) {
    position+=n;
    return n;
  }
 else {
    n=this.end - position;
    position=this.end;
    return n;
  }
}

Fixed version (ground truth):
@Override public int skipBytes(int n) throws IOException {
  if (this.position <= this.end - n) {
    this.position+=n;
    return n;
  }
 else {
    n=this.end - this.position;
    this.position=this.end;
    return n;
  }
}
Program: 56072
Project: 56072
Buggy source:
@Override public int getPosition(){
  return position - this.offset;
}

Fixed version (ground truth):
@Override public int getPosition(){
  return this.position - this.offset;
}
Program: 56073
Project: 56073
Buggy source:
@Override public long readLong() throws IOException {
  if (position >= 0 && position + 7 < this.end) {
    return (((long)this.memory[position++] & 0xff) << 56) | (((long)this.memory[position++] & 0xff) << 48) | (((long)this.memory[position++] & 0xff) << 40)| (((long)this.memory[position++] & 0xff) << 32)| (((long)this.memory[position++] & 0xff) << 24)| (((long)this.memory[position++] & 0xff) << 16)| (((long)this.memory[position++] & 0xff) << 8)| (((long)this.memory[position++] & 0xff) << 0);
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public long readLong() throws IOException {
  if (position >= 0 && position < this.end - 7) {
    return (((long)this.memory[position++] & 0xff) << 56) | (((long)this.memory[position++] & 0xff) << 48) | (((long)this.memory[position++] & 0xff) << 40)| (((long)this.memory[position++] & 0xff) << 32)| (((long)this.memory[position++] & 0xff) << 24)| (((long)this.memory[position++] & 0xff) << 16)| (((long)this.memory[position++] & 0xff) << 8)| (((long)this.memory[position++] & 0xff) << 0);
  }
 else {
    throw new EOFException();
  }
}
Program: 56074
Project: 56074
Buggy source:
@Override public short readShort() throws IOException {
  if (position >= 0 && position + 1 < this.end) {
    return (short)((((this.memory[position++]) & 0xff) << 8) | (((this.memory[position++]) & 0xff) << 0));
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public short readShort() throws IOException {
  if (position >= 0 && position < this.end - 1) {
    return (short)((((this.memory[position++]) & 0xff) << 8) | (((this.memory[position++]) & 0xff) << 0));
  }
 else {
    throw new EOFException();
  }
}
Program: 56075
Project: 56075
Buggy source:
@Override public void readFully(byte[] b,int off,int len) throws IOException {
  if (position < this.end && position + len <= this.end && off + len <= b.length) {
    System.arraycopy(this.memory,position,b,off,len);
    position+=len;
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public void readFully(byte[] b,int off,int len) throws IOException {
  if (this.position < this.end && this.position <= this.end - len && off <= b.length - len) {
    System.arraycopy(this.memory,position,b,off,len);
    position+=len;
  }
 else {
    throw new EOFException();
  }
}
Program: 56076
Project: 56076
Buggy source:
@Override public DataInputView reset(){
  position=this.offset;
  return this;
}

Fixed version (ground truth):
@Override public DataInputView reset(){
  this.position=this.offset;
  return this;
}
Program: 56077
Project: 56077
Buggy source:
@Override public boolean readBoolean() throws IOException {
  if (position < this.end) {
    return this.memory[position++] != 0;
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public boolean readBoolean() throws IOException {
  if (this.position < this.end) {
    return this.memory[this.position++] != 0;
  }
 else {
    throw new EOFException();
  }
}
Program: 56078
Project: 56078
Buggy source:
@Override public byte readByte() throws IOException {
  if (position < this.end) {
    return this.memory[position++];
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public byte readByte() throws IOException {
  if (this.position < this.end) {
    return this.memory[this.position++];
  }
 else {
    throw new EOFException();
  }
}
Program: 56079
Project: 56079
Buggy source:
@Override public int readInt() throws IOException {
  if (position >= 0 && position + 3 < this.end) {
    return ((this.memory[position++] & 0xff) << 24) | ((this.memory[position++] & 0xff) << 16) | ((this.memory[position++] & 0xff) << 8)| ((this.memory[position++] & 0xff) << 0);
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public int readInt() throws IOException {
  if (this.position >= 0 && this.position < this.end - 3) {
    return ((this.memory[position++] & 0xff) << 24) | ((this.memory[position++] & 0xff) << 16) | ((this.memory[position++] & 0xff) << 8)| ((this.memory[position++] & 0xff) << 0);
  }
 else {
    throw new EOFException();
  }
}
Program: 56080
Project: 56080
Buggy source:
@Override public int readUnsignedByte() throws IOException {
  if (position < this.end) {
    return (this.memory[position++] & 0xff);
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public int readUnsignedByte() throws IOException {
  if (this.position < this.end) {
    return (this.memory[this.position++] & 0xff);
  }
 else {
    throw new EOFException();
  }
}
Program: 56081
Project: 56081
Buggy source:
@Override public int readUnsignedShort() throws IOException {
  if (position + 1 < this.end) {
    return ((this.memory[position++] & 0xff) << 8) | ((this.memory[position++] & 0xff) << 0);
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public int readUnsignedShort() throws IOException {
  if (this.position < this.end - 1) {
    return ((this.memory[this.position++] & 0xff) << 8) | ((this.memory[this.position++] & 0xff) << 0);
  }
 else {
    throw new EOFException();
  }
}
Program: 56082
Project: 56082
Buggy source:
@Override public void writeInt(int v) throws IOException {
  if (position + 3 < this.end) {
    this.memory[position++]=(byte)((v >> 24) & 0xff);
    this.memory[position++]=(byte)((v >> 16) & 0xff);
    this.memory[position++]=(byte)((v >> 8) & 0xff);
    this.memory[position++]=(byte)((v >> 0) & 0xff);
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public void writeInt(int v) throws IOException {
  if (position < this.end - 3) {
    this.memory[position++]=(byte)((v >> 24) & 0xff);
    this.memory[position++]=(byte)((v >> 16) & 0xff);
    this.memory[position++]=(byte)((v >> 8) & 0xff);
    this.memory[position++]=(byte)((v >> 0) & 0xff);
  }
 else {
    throw new EOFException();
  }
}
Program: 56083
Project: 56083
Buggy source:
@Override public void writeChar(int v) throws IOException {
  if (position + 1 < this.end) {
    this.memory[position++]=(byte)((v >> 8) & 0xff);
    this.memory[position++]=(byte)((v >> 0) & 0xff);
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public void writeChar(int v) throws IOException {
  if (position < this.end - 1) {
    this.memory[position++]=(byte)((v >> 8) & 0xff);
    this.memory[position++]=(byte)((v >> 0) & 0xff);
  }
 else {
    throw new EOFException();
  }
}
Program: 56084
Project: 56084
Buggy source:
@Override public void writeLong(long v) throws IOException {
  if (position + 7 < this.end) {
    this.memory[position++]=(byte)((v >> 56) & 0xff);
    this.memory[position++]=(byte)((v >> 48) & 0xff);
    this.memory[position++]=(byte)((v >> 40) & 0xff);
    this.memory[position++]=(byte)((v >> 32) & 0xff);
    this.memory[position++]=(byte)((v >> 24) & 0xff);
    this.memory[position++]=(byte)((v >> 16) & 0xff);
    this.memory[position++]=(byte)((v >> 8) & 0xff);
    this.memory[position++]=(byte)((v >> 0) & 0xff);
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public void writeLong(long v) throws IOException {
  if (position < this.end - 7) {
    this.memory[position++]=(byte)((v >> 56) & 0xff);
    this.memory[position++]=(byte)((v >> 48) & 0xff);
    this.memory[position++]=(byte)((v >> 40) & 0xff);
    this.memory[position++]=(byte)((v >> 32) & 0xff);
    this.memory[position++]=(byte)((v >> 24) & 0xff);
    this.memory[position++]=(byte)((v >> 16) & 0xff);
    this.memory[position++]=(byte)((v >> 8) & 0xff);
    this.memory[position++]=(byte)((v >> 0) & 0xff);
  }
 else {
    throw new EOFException();
  }
}
Program: 56085
Project: 56085
Buggy source:
@Override public int getPosition(){
  return position - this.offset;
}

Fixed version (ground truth):
@Override public int getPosition(){
  return this.position - this.offset;
}
Program: 56086
Project: 56086
Buggy source:
@Override public void writeBytes(String s) throws IOException {
  final int sLen=s.length();
  if (this.position + sLen < this.end) {
    for (int i=0; i < sLen; i++) {
      writeByte(s.charAt(i));
    }
    this.position+=sLen;
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public void writeBytes(String s) throws IOException {
  final int sLen=s.length();
  if (this.position < this.end - sLen) {
    for (int i=0; i < sLen; i++) {
      writeByte(s.charAt(i));
    }
    this.position+=sLen;
  }
 else {
    throw new EOFException();
  }
}
Program: 56087
Project: 56087
Buggy source:
@Override public DataOutputView reset(){
  position=this.offset;
  return this;
}

Fixed version (ground truth):
@Override public DataOutputView reset(){
  this.position=this.offset;
  return this;
}
Program: 56088
Project: 56088
Buggy source:
@Override public void writeShort(int v) throws IOException {
  if (position + 1 < this.end) {
    this.memory[position++]=(byte)((v >>> 8) & 0xff);
    this.memory[position++]=(byte)((v >>> 0) & 0xff);
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public void writeShort(int v) throws IOException {
  if (position < this.end - 1) {
    this.memory[position++]=(byte)((v >>> 8) & 0xff);
    this.memory[position++]=(byte)((v >>> 0) & 0xff);
  }
 else {
    throw new EOFException();
  }
}
Program: 56089
Project: 56089
Buggy source:
@Override public void writeChars(String s) throws IOException {
  if (position + 2 * s.length() < this.end) {
    int length=s.length();
    for (int i=0; i < length; i++) {
      writeChar(s.charAt(i));
    }
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public void writeChars(String s) throws IOException {
  if (position < this.end - (2 * s.length())) {
    int length=s.length();
    for (int i=0; i < length; i++) {
      writeChar(s.charAt(i));
    }
  }
 else {
    throw new EOFException();
  }
}
Program: 56090
Project: 56090
Buggy source:
@Override public void write(byte[] b,int off,int len) throws IOException {
  if (position < this.end && position + len <= this.end && off + len <= b.length) {
    System.arraycopy(b,off,this.memory,position,len);
    position+=len;
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public void write(byte[] b,int off,int len) throws IOException {
  if (this.position < this.end && this.position <= this.end - len && off <= b.length - len) {
    System.arraycopy(b,off,this.memory,position,len);
    this.position+=len;
  }
 else {
    throw new EOFException();
  }
}
Program: 56091
Project: 56091
Buggy source:
@Override public void writeBoolean(boolean v) throws IOException {
  if (position < this.end) {
    this.memory[position++]=(byte)(v ? 1 : 0);
  }
 else {
    throw new EOFException();
  }
}

Fixed version (ground truth):
@Override public void writeBoolean(boolean v) throws IOException {
  if (this.position < this.end) {
    this.memory[this.position++]=(byte)(v ? 1 : 0);
  }
 else {
    throw new EOFException();
  }
}
Program: 56092
Project: 56092
Buggy source:
@Override public RandomAccessView get(DataOutput out,int offset,int length) throws IOException {
  if (offset >= 0 && offset < this.size && length >= 0 && length < this.size) {
    out.write(this.memory,this.offset + offset,length);
    return this;
  }
 else {
    throw new IndexOutOfBoundsException();
  }
}

Fixed version (ground truth):
@Override public RandomAccessView get(DataOutput out,int offset,int length) throws IOException {
  if (offset >= 0 && offset < this.size && length >= 0 && offset + length < this.size) {
    out.write(this.memory,this.offset + offset,length);
    return this;
  }
 else {
    throw new IndexOutOfBoundsException();
  }
}
Program: 56094
Project: 56094
Buggy source:
/** 
 * Sets the shipping strategy for this connection.
 * @param strategy The shipping strategy to be applied to this connection.
 */
public void setShipStrategy(ShipStrategy strategy){
  if (strategy == ShipStrategy.FORWARD && sourcePact.getDegreeOfParallelism() < targetPact.getDegreeOfParallelism()) {
    for (    InterestingProperties props : this.interestingProps) {
      PartitionProperty pp=props.getGlobalProperties().getPartitioning();
      if (pp == PartitionProperty.HASH_PARTITIONED || pp == PartitionProperty.ANY) {
        strategy=ShipStrategy.PARTITION_LOCAL_HASH;
        break;
      }
 else       if (pp == PartitionProperty.RANGE_PARTITIONED) {
        throw new CompilerException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
  this.shipStrategy=strategy;
}

Fixed version (ground truth):
/** 
 * Sets the shipping strategy for this connection.
 * @param strategy The shipping strategy to be applied to this connection.
 */
public void setShipStrategy(ShipStrategy strategy){
  if (strategy == ShipStrategy.FORWARD && sourcePact.getDegreeOfParallelism() < targetPact.getDegreeOfParallelism()) {
    if (this.interestingProps != null) {
      for (      InterestingProperties props : this.interestingProps) {
        PartitionProperty pp=props.getGlobalProperties().getPartitioning();
        if (pp == PartitionProperty.HASH_PARTITIONED || pp == PartitionProperty.ANY) {
          strategy=ShipStrategy.PARTITION_LOCAL_HASH;
          break;
        }
 else         if (pp == PartitionProperty.RANGE_PARTITIONED) {
          throw new CompilerException("String_Node_Str" + "String_Node_Str");
        }
      }
    }
  }
  this.shipStrategy=strategy;
}
Program: 56102
Project: 56102
Buggy source:
/** 
 * Sets the shipping strategy for this connection.
 * @param strategy The shipping strategy to be applied to this connection.
 */
public void setShipStrategy(ShipStrategy strategy){
  if (strategy == ShipStrategy.FORWARD && sourcePact.getDegreeOfParallelism() < targetPact.getDegreeOfParallelism()) {
    for (    InterestingProperties props : this.interestingProps) {
      PartitionProperty pp=props.getGlobalProperties().getPartitioning();
      if (pp == PartitionProperty.HASH_PARTITIONED || pp == PartitionProperty.ANY) {
        strategy=ShipStrategy.PARTITION_LOCAL_HASH;
        break;
      }
 else       if (pp == PartitionProperty.RANGE_PARTITIONED) {
        throw new CompilerException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
  this.shipStrategy=strategy;
}

Fixed version (ground truth):
/** 
 * Sets the shipping strategy for this connection.
 * @param strategy The shipping strategy to be applied to this connection.
 */
public void setShipStrategy(ShipStrategy strategy){
  if (strategy == ShipStrategy.FORWARD && sourcePact.getDegreeOfParallelism() < targetPact.getDegreeOfParallelism()) {
    if (this.interestingProps != null) {
      for (      InterestingProperties props : this.interestingProps) {
        PartitionProperty pp=props.getGlobalProperties().getPartitioning();
        if (pp == PartitionProperty.HASH_PARTITIONED || pp == PartitionProperty.ANY) {
          strategy=ShipStrategy.PARTITION_LOCAL_HASH;
          break;
        }
 else         if (pp == PartitionProperty.RANGE_PARTITIONED) {
          throw new CompilerException("String_Node_Str" + "String_Node_Str");
        }
      }
    }
  }
  this.shipStrategy=strategy;
}
Program: 56103
Project: 56103
Buggy source:
@Test public void testJob() throws Exception {
  preSubmit();
  JobGraph jobGraph=getJobGraph();
  cluster.submitJobAndWait(jobGraph,getJarFilePath());
  postSubmit();
}

Fixed version (ground truth):
@Test public void testJob() throws Exception {
  preSubmit();
  JobGraph jobGraph=null;
  try {
    jobGraph=getJobGraph();
  }
 catch (  Exception e) {
    LOG.error(e);
    Assert.fail("String_Node_Str");
  }
  try {
    cluster.submitJobAndWait(jobGraph,getJarFilePath());
  }
 catch (  Exception e) {
    LOG.error(e);
    Assert.fail("String_Node_Str");
  }
  postSubmit();
}
Program: 56107
Project: 56107
Buggy source:
@Override public boolean equals(Object o){
  return (o.getClass() == PactNull.class);
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  return (o != null && o.getClass() == PactNull.class);
}
Program: 56115
Project: 56115
Buggy source:
/** 
 * Copy constructor to create a copy of the data-source object for the process of plan enumeration.
 * @param template The node to create a copy of.
 * @param gp The global properties of this copy.
 * @param lp The local properties of this copy.
 */
protected DataSourceNode(DataSourceNode template,GlobalProperties gp,LocalProperties lp){
  super(template,gp,lp);
}

Fixed version (ground truth):
/** 
 * Copy constructor to create a copy of the data-source object for the process of plan enumeration.
 * @param template The node to create a copy of.
 * @param gp The global properties of this copy.
 * @param lp The local properties of this copy.
 */
protected DataSourceNode(DataSourceNode template,GlobalProperties gp,LocalProperties lp){
  super(template,gp,lp);
  this.fileSize=template.fileSize;
}
Program: 56116
Project: 56116
Buggy source:
@Override public List<MapNode> getAlternativePlans(CostEstimator estimator){
  if (cachedPlans != null) {
    return cachedPlans;
  }
  List<? extends OptimizerNode> inPlans=input.getSourcePact().getAlternativePlans(estimator);
  List<MapNode> outputPlans=new ArrayList<MapNode>();
  for (  OptimizerNode pred : inPlans) {
    ShipStrategy ss=input.getShipStrategy() == ShipStrategy.NONE ? ShipStrategy.FORWARD : input.getShipStrategy();
    GlobalProperties gp=PactConnection.getGlobalPropertiesAfterConnection(pred,ss);
    LocalProperties lp=PactConnection.getLocalPropertiesAfterConnection(pred,ss);
    MapNode nMap=new MapNode(this,pred,input,gp,lp);
    nMap.input.setShipStrategy(ss);
    nMap.getGlobalProperties().getPreservedAfterContract(getOutputContract());
    nMap.getLocalProperties().getPreservedAfterContract(getOutputContract());
    estimator.costOperator(nMap);
    outputPlans.add(nMap);
  }
  prunePlanAlternatives(outputPlans);
  if (this.getOutgoingConnections() != null && this.getOutgoingConnections().size() > 1) {
    this.cachedPlans=outputPlans;
  }
  return outputPlans;
}

Fixed version (ground truth):
@Override public List<MapNode> getAlternativePlans(CostEstimator estimator){
  if (cachedPlans != null) {
    return cachedPlans;
  }
  List<? extends OptimizerNode> inPlans=input.getSourcePact().getAlternativePlans(estimator);
  List<MapNode> outputPlans=new ArrayList<MapNode>();
  for (  OptimizerNode pred : inPlans) {
    ShipStrategy ss=input.getShipStrategy() == ShipStrategy.NONE ? ShipStrategy.FORWARD : input.getShipStrategy();
    GlobalProperties gp=PactConnection.getGlobalPropertiesAfterConnection(pred,this,ss);
    LocalProperties lp=PactConnection.getLocalPropertiesAfterConnection(pred,this,ss);
    MapNode nMap=new MapNode(this,pred,input,gp,lp);
    nMap.input.setShipStrategy(ss);
    nMap.getGlobalProperties().getPreservedAfterContract(getOutputContract());
    nMap.getLocalProperties().getPreservedAfterContract(getOutputContract());
    estimator.costOperator(nMap);
    outputPlans.add(nMap);
  }
  prunePlanAlternatives(outputPlans);
  if (this.getOutgoingConnections() != null && this.getOutgoingConnections().size() > 1) {
    this.cachedPlans=outputPlans;
  }
  return outputPlans;
}
Program: 56120
Project: 56120
Buggy source:
/** 
 * Blocks until all output channels are closed.
 * @throws IOException thrown if an error occurred while closing the output channels
 */
private void waitForOutputChannelsToBeClosed() throws IOException {
  while (true) {
    boolean allClosed=true;
    for (int i=0; i < getNumberOfOutputGates(); i++) {
      final OutputGate<? extends Record> eog=getOutputGate(i);
      if (!eog.isClosed()) {
        allClosed=false;
      }
    }
    if (allClosed) {
      break;
    }
 else {
      try {
        Thread.sleep(SLEEPINTERVAL);
      }
 catch (      InterruptedException e) {
        LOG.debug(e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Blocks until all output channels are closed.
 * @throws IOException thrown if an error occurred while closing the output channels
 * @throws InterruptedException thrown if the thread waiting for the channels to be closed is interrupted
 */
private void waitForOutputChannelsToBeClosed() throws IOException, InterruptedException {
  while (true) {
    if (this.isCanceled) {
      throw new InterruptedException();
    }
    boolean allClosed=true;
    for (int i=0; i < getNumberOfOutputGates(); i++) {
      final OutputGate<? extends Record> eog=getOutputGate(i);
      if (!eog.isClosed()) {
        allClosed=false;
      }
    }
    if (allClosed) {
      break;
    }
 else {
      Thread.sleep(SLEEPINTERVAL);
    }
  }
}
Program: 56121
Project: 56121
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  if (invokable == null) {
    LOG.fatal("String_Node_Str");
  }
  changeExecutionState(ExecutionState.RUNNING,null);
  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) {
    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);
  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);
}
Program: 56122
Project: 56122
Buggy source:
/** 
 * Blocks until all input channels are closed.
 * @throws IOException thrown if an error occurred while closing the input channels
 */
private void waitForInputChannelsToBeClosed() throws IOException {
  while (true) {
    boolean allClosed=true;
    for (int i=0; i < getNumberOfInputGates(); i++) {
      final InputGate<? extends Record> eig=getInputGate(i);
      if (!eig.isClosed()) {
        allClosed=false;
      }
    }
    if (allClosed) {
      break;
    }
 else {
      try {
        Thread.sleep(SLEEPINTERVAL);
      }
 catch (      InterruptedException e) {
        LOG.debug(e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Blocks until all input channels are closed.
 * @throws IOException thrown if an error occurred while closing the input channels
 * @throws InterruptedException thrown if the thread waiting for the channels to be closed is interrupted
 */
private void waitForInputChannelsToBeClosed() throws IOException, InterruptedException {
  while (true) {
    if (this.isCanceled) {
      throw new InterruptedException();
    }
    boolean allClosed=true;
    for (int i=0; i < getNumberOfInputGates(); i++) {
      final InputGate<? extends Record> eig=getInputGate(i);
      if (!eig.isClosed()) {
        allClosed=false;
      }
    }
    if (allClosed) {
      break;
    }
 else {
      Thread.sleep(SLEEPINTERVAL);
    }
  }
}
Program: 56123
Project: 56123
Buggy source:
public void read() throws IOException, EOFException {
  if (!isActiveConnection()) {
    System.out.println("String_Node_Str");
    return;
  }
  this.deserializer.read(this.readableByteChannel);
  final TransferEnvelope transferEnvelope=this.deserializer.getFullyDeserializedTransferEnvelope();
  if (transferEnvelope != null) {
    this.byteBufferedChannelManager.queueIncomingTransferEnvelope(transferEnvelope);
  }
}

Fixed version (ground truth):
public void read() throws IOException, EOFException {
  if (this.inactiveConnection) {
    final ByteBuffer buf=ByteBuffer.allocate(8);
    final int bytesRead=this.readableByteChannel.read(buf);
    if (bytesRead == 0) {
      return;
    }
 else     if (bytesRead == -1) {
      throw new EOFException();
    }
 else {
      throw new IOException("String_Node_Str" + bytesRead + "String_Node_Str");
    }
  }
  this.deserializer.read(this.readableByteChannel);
  final TransferEnvelope transferEnvelope=this.deserializer.getFullyDeserializedTransferEnvelope();
  if (transferEnvelope != null) {
    this.byteBufferedChannelManager.queueIncomingTransferEnvelope(transferEnvelope);
  }
}
Program: 56124
Project: 56124
Buggy source:
public void reportTransmissionProblem(SelectionKey key,IOException ioe){
  if (!this.readsFromCheckpoint) {
    final SocketChannel socketChannel=(SocketChannel)this.readableByteChannel;
    LOG.error("String_Node_Str" + socketChannel.socket().getRemoteSocketAddress() + "String_Node_Str");
  }
  LOG.error(ioe);
  try {
    this.readableByteChannel.close();
  }
 catch (  IOException e) {
    LOG.debug("String_Node_Str");
  }
  if (key != null) {
    key.cancel();
  }
  if (this.deserializer.getBuffer() != null) {
    this.deserializer.getBuffer().recycleBuffer();
  }
  this.deserializer.reset();
  this.byteBufferedChannelManager.unregisterIncomingConnection(this.incomingConnectionID,this.readableByteChannel);
}

Fixed version (ground truth):
public void reportTransmissionProblem(SelectionKey key,IOException ioe){
  if (!this.readsFromCheckpoint) {
    final SocketChannel socketChannel=(SocketChannel)this.readableByteChannel;
    LOG.error("String_Node_Str" + socketChannel.socket().getRemoteSocketAddress() + "String_Node_Str");
  }
  LOG.error(ioe);
  try {
    this.readableByteChannel.close();
  }
 catch (  IOException e) {
    LOG.debug("String_Node_Str");
  }
  if (key != null) {
    key.cancel();
  }
  if (this.deserializer.getBuffer() != null) {
    this.deserializer.getBuffer().recycleBuffer();
  }
  this.deserializer.reset();
  if (!this.inactiveConnection) {
    this.byteBufferedChannelManager.unregisterIncomingConnection(this.incomingConnectionID,this.readableByteChannel);
  }
}
Program: 56125
Project: 56125
Buggy source:
public void closeConnection(SelectionKey key){
  try {
    this.readableByteChannel.close();
  }
 catch (  IOException ioe) {
    LOG.error("String_Node_Str" + StringUtils.stringifyException(ioe));
  }
  if (key != null) {
    key.cancel();
  }
  this.byteBufferedChannelManager.unregisterIncomingConnection(this.incomingConnectionID,this.readableByteChannel);
}

Fixed version (ground truth):
public void closeConnection(SelectionKey key){
  try {
    this.readableByteChannel.close();
  }
 catch (  IOException ioe) {
    LOG.error("String_Node_Str" + StringUtils.stringifyException(ioe));
  }
  if (key != null) {
    key.cancel();
  }
  if (!this.inactiveConnection) {
    this.byteBufferedChannelManager.unregisterIncomingConnection(this.incomingConnectionID,this.readableByteChannel);
  }
}
Program: 56126
Project: 56126
Buggy source:
/** 
 * Requests all output gates to be closed.
 */
private void requestAllOutputGatesToClose() throws IOException {
  for (int i=0; i < getNumberOfOutputGates(); i++) {
    this.getOutputGate(i).requestClose();
  }
}

Fixed version (ground truth):
/** 
 * Requests all output gates to be closed.
 */
private void requestAllOutputGatesToClose() throws IOException, InterruptedException {
  for (int i=0; i < getNumberOfOutputGates(); i++) {
    this.getOutputGate(i).requestClose();
  }
}
Program: 56127
Project: 56127
Buggy source:
/** 
 * Publishes an event.
 * @param event the event to be published
 * @throws IOException thrown if an error occurs while transmitting the event
 */
public void publishEvent(AbstractTaskEvent event) throws IOException {
  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 {
  Iterator<AbstractInputChannel<T>> it=this.inputChannels.iterator();
  while (it.hasNext()) {
    it.next().transferEvent(event);
  }
}
Program: 56128
Project: 56128
Buggy source:
/** 
 * Requests the output gate to closed. This means the application will send no records through this gate anymore.
 */
public void requestClose() throws IOException {
  for (int i=0; i < this.getNumberOfOutputChannels(); i++) {
    final AbstractOutputChannel<T> outputChannel=this.getOutputChannel(i);
    outputChannel.requestClose();
  }
}

Fixed version (ground truth):
/** 
 * Requests the output gate to closed. This means the application will send no records through this gate anymore.
 */
public void requestClose() throws IOException, InterruptedException {
  for (int i=0; i < this.getNumberOfOutputChannels(); i++) {
    final AbstractOutputChannel<T> outputChannel=this.getOutputChannel(i);
    outputChannel.requestClose();
  }
}
Program: 56129
Project: 56129
Buggy source:
public void flush() throws IOException {
  final Iterator<AbstractOutputChannel<T>> it=this.outputChannels.iterator();
  while (it.hasNext()) {
    it.next().flush();
  }
}

Fixed version (ground truth):
public void flush() throws IOException, InterruptedException {
  final Iterator<AbstractOutputChannel<T>> it=this.outputChannels.iterator();
  while (it.hasNext()) {
    it.next().flush();
  }
}
Program: 56130
Project: 56130
Buggy source:
/** 
 * Publishes an event.
 * @param event the event to be published
 * @throws IOException thrown if an error occurs while transmitting the event
 */
public void publishEvent(AbstractTaskEvent event) throws IOException {
  final Iterator<AbstractOutputChannel<T>> it=this.outputChannels.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<AbstractOutputChannel<T>> it=this.outputChannels.iterator();
  while (it.hasNext()) {
    it.next().transferEvent(event);
  }
}
Program: 56131
Project: 56131
Buggy source:
/** 
 * Publishes an event.
 * @param event the event to be published
 * @throws IOException thrown if an error occurs while transmitting the event
 */
public void publishEvent(AbstractTaskEvent event) throws IOException {
  this.inputGate.publishEvent(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 {
  this.inputGate.publishEvent(event);
}
Program: 56132
Project: 56132
Buggy source:
public void flush() throws IOException {
  this.outputGate.flush();
}

Fixed version (ground truth):
public void flush() throws IOException, InterruptedException {
  this.outputGate.flush();
}
Program: 56133
Project: 56133
Buggy source:
/** 
 * Publishes an event.
 * @param event the event to be published
 * @throws IOException thrown if an error occurs while transmitting the event
 */
public void publishEvent(AbstractTaskEvent event) throws IOException {
  this.outputGate.publishEvent(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 {
  this.outputGate.publishEvent(event);
}
Program: 56134
Project: 56134
Buggy source:
/** 
 * Connects a record writer to an output gate.
 * @param outputClass the class of the record that can be emitted with this record writer
 */
@SuppressWarnings("String_Node_Str") private void connectOutputGate(Class<T> outputClass,ChannelSelector selector){
  if (this.environment.hasUnboundOutputGates()) {
    final OutputGate<T> eog=(OutputGate<T>)this.environment.getUnboundOutputGate(0);
    if (!outputClass.equals(eog.getType())) {
      throw new RuntimeException("String_Node_Str");
    }
    this.outputGate=eog;
  }
 else {
    this.outputGate=new OutputGate<T>(outputClass,this.environment.getNumberOfOutputGates(),selector);
    this.environment.registerOutputGate(this.outputGate);
  }
}

Fixed version (ground truth):
/** 
 * Connects a record writer to an output gate.
 * @param outputClass the class of the record that can be emitted with this record writer
 */
@SuppressWarnings("String_Node_Str") private void connectOutputGate(Class<T> outputClass,ChannelSelector<T> selector){
  if (this.environment.hasUnboundOutputGates()) {
    final OutputGate<T> eog=(OutputGate<T>)this.environment.getUnboundOutputGate(0);
    if (!outputClass.equals(eog.getType())) {
      throw new RuntimeException("String_Node_Str");
    }
    this.outputGate=eog;
  }
 else {
    this.outputGate=new OutputGate<T>(outputClass,this.environment.getNumberOfOutputGates(),selector);
    this.environment.registerOutputGate(this.outputGate);
  }
}
Program: 56135
Project: 56135
Buggy source:
public abstract void transferEvent(AbstractEvent event) throws IOException ;

Fixed version (ground truth):
public abstract void transferEvent(AbstractEvent event) throws IOException, InterruptedException ;
Program: 56136
Project: 56136
Buggy source:
public abstract void flush() throws IOException ;

Fixed version (ground truth):
public abstract void flush() throws IOException, InterruptedException ;
Program: 56137
Project: 56137
Buggy source:
/** 
 * Requests the output channel to close. After calling this method no more records can be written to the channel. The channel is finally closed when all remaining data that may exist in internal buffers are written to the channel.
 */
public abstract void requestClose() throws IOException ;

Fixed version (ground truth):
/** 
 * Requests the output channel to close. After calling this method no more records can be written to the channel. The channel is finally closed when all remaining data that may exist in internal buffers are written to the channel.
 * @throws IOException thrown if an I/O error occurs while requesting the channel to close
 * @throws InterruptedException thrown if the thread is interrupted while requesting the channel to close
 */
public abstract void requestClose() throws IOException, InterruptedException ;
Program: 56138
Project: 56138
Buggy source:
@SuppressWarnings("String_Node_Str") private AbstractDirectInputChannel<T> getConnectedInputChannel() throws IOException {
  AbstractDirectInputChannel<T> directInputChannel=null;
  if (this.directChannelBroker == null) {
    throw new IOException("String_Node_Str");
  }
  for (int i=0; i < this.numberOfConnectionRetries; i++) {
    directInputChannel=(AbstractDirectInputChannel<T>)this.directChannelBroker.getDirectInputChannelByID(getConnectedChannelID());
    if (directInputChannel != null) {
      return directInputChannel;
    }
    try {
      Thread.sleep(CONNECTION_SLEEP_INTERVAL);
    }
 catch (    InterruptedException e) {
      LOG.error(e);
    }
  }
  throw new IOException("String_Node_Str" + getID());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private AbstractDirectInputChannel<T> getConnectedInputChannel() throws IOException, InterruptedException {
  AbstractDirectInputChannel<T> directInputChannel=null;
  if (this.directChannelBroker == null) {
    throw new IOException("String_Node_Str");
  }
  for (int i=0; i < this.numberOfConnectionRetries; i++) {
    directInputChannel=(AbstractDirectInputChannel<T>)this.directChannelBroker.getDirectInputChannelByID(getConnectedChannelID());
    if (directInputChannel != null) {
      return directInputChannel;
    }
    Thread.sleep(CONNECTION_SLEEP_INTERVAL);
  }
  throw new IOException("String_Node_Str" + getID());
}
Program: 56139
Project: 56139
Buggy source:
@Override public void flush() throws IOException {
  if (this.connectedDirectInputChannel == null) {
    this.connectedDirectInputChannel=getConnectedInputChannel();
  }
  this.connectedDirectInputChannel.requestFlush();
}

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

Fixed version (ground truth):
@Override public void transferEvent(AbstractEvent event) throws IOException, InterruptedException {
  if (this.connectedDirectInputChannel == null) {
    this.connectedDirectInputChannel=getConnectedInputChannel();
  }
  this.connectedDirectInputChannel.processEvent(event);
}
Program: 56141
Project: 56141
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void requestClose(){
  this.closeRequested=true;
  if (this.connectedDirectInputChannel == null) {
    try {
      this.connectedDirectInputChannel=getConnectedInputChannel();
    }
 catch (    IOException e) {
      this.connectionFailureException=e;
      return;
    }
  }
  this.connectedDirectInputChannel.requestClose();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void requestClose() throws InterruptedException {
  this.closeRequested=true;
  if (this.connectedDirectInputChannel == null) {
    try {
      this.connectedDirectInputChannel=getConnectedInputChannel();
    }
 catch (    IOException e) {
      this.connectionFailureException=e;
      return;
    }
  }
  this.connectedDirectInputChannel.requestClose();
}
Program: 56142
Project: 56142
Buggy source:
/** 
 * This test checks the correct registration/deregistration of   {@link AbstractDirectInputChannel} and{@link AbstractDirectOutputChannel} objects.
 */
@Test public void testDirectChannelManager(){
  final DirectChannelManager dcm=new DirectChannelManager();
  when(this.deserializer.getRecordType()).thenReturn(StringRecord.class);
  final InMemoryInputChannel<StringRecord> inputChannel=new InMemoryInputChannel<StringRecord>(this.inputGate,0,this.deserializer,this.inputChannelID,CompressionLevel.NO_COMPRESSION);
  final InMemoryOutputChannel<StringRecord> outputChannel=new InMemoryOutputChannel<StringRecord>(this.outputGate,0,this.outputChannelID,CompressionLevel.NO_COMPRESSION);
  inputChannel.setConnectedChannelID(this.outputChannelID);
  outputChannel.setConnectedChannelID(this.inputChannelID);
  dcm.registerDirectInputChannel(inputChannel);
  dcm.registerDirectOutputChannel(outputChannel);
  try {
    outputChannel.transferEvent(new StringTaskEvent("String_Node_Str"));
  }
 catch (  IOException ioe) {
    fail(ioe.getMessage());
  }
  assertEquals(inputChannel,dcm.getDirectInputChannelByID(this.inputChannelID));
  assertEquals(outputChannel,dcm.getDirectOutputChannelByID(this.outputChannelID));
  dcm.unregisterDirectInputChannel(inputChannel);
  dcm.unregisterDirectOutputChannel(outputChannel);
  assertEquals(null,dcm.getDirectInputChannelByID(this.inputChannelID));
  assertEquals(null,dcm.getDirectOutputChannelByID(this.outputChannelID));
}

Fixed version (ground truth):
/** 
 * This test checks the correct registration/deregistration of   {@link AbstractDirectInputChannel} and{@link AbstractDirectOutputChannel} objects.
 */
@Test public void testDirectChannelManager(){
  final DirectChannelManager dcm=new DirectChannelManager();
  when(this.deserializer.getRecordType()).thenReturn(StringRecord.class);
  final InMemoryInputChannel<StringRecord> inputChannel=new InMemoryInputChannel<StringRecord>(this.inputGate,0,this.deserializer,this.inputChannelID,CompressionLevel.NO_COMPRESSION);
  final InMemoryOutputChannel<StringRecord> outputChannel=new InMemoryOutputChannel<StringRecord>(this.outputGate,0,this.outputChannelID,CompressionLevel.NO_COMPRESSION);
  inputChannel.setConnectedChannelID(this.outputChannelID);
  outputChannel.setConnectedChannelID(this.inputChannelID);
  dcm.registerDirectInputChannel(inputChannel);
  dcm.registerDirectOutputChannel(outputChannel);
  try {
    outputChannel.transferEvent(new StringTaskEvent("String_Node_Str"));
  }
 catch (  IOException ioe) {
    fail(ioe.getMessage());
  }
catch (  InterruptedException ie) {
    fail(ie.getMessage());
  }
  assertEquals(inputChannel,dcm.getDirectInputChannelByID(this.inputChannelID));
  assertEquals(outputChannel,dcm.getDirectOutputChannelByID(this.outputChannelID));
  dcm.unregisterDirectInputChannel(inputChannel);
  dcm.unregisterDirectOutputChannel(outputChannel);
  assertEquals(null,dcm.getDirectInputChannelByID(this.inputChannelID));
  assertEquals(null,dcm.getDirectOutputChannelByID(this.outputChannelID));
}
Program: 56144
Project: 56144
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean equals(Object obj){
  if (this.inetAddress != null) {
    return this.inetAddress.equals(obj);
  }
 else {
    return this.fileName.equals(obj);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean equals(Object obj){
  if (!(obj instanceof IncomingConnectionID)) {
    return false;
  }
  final IncomingConnectionID ici=(IncomingConnectionID)obj;
  if (this.inetAddress != null) {
    return this.inetAddress.equals(ici.inetAddress);
  }
 else {
    return this.fileName.equals(ici.fileName);
  }
}
Program: 56145
Project: 56145
Buggy source:
@Override public byte[] writeLine(KeyValuePair<PactInteger,CoordVector> pair){
  StringBuilder line=new StringBuilder();
  DecimalFormat df=new DecimalFormat("String_Node_Str");
  line.append(pair.getKey().getValue());
  for (  double coord : pair.getValue().getCoordinates()) {
    line.append('|');
    line.append(df.format(coord));
  }
  line.append('|');
  line.append('\n');
  return line.toString().getBytes();
}

Fixed version (ground truth):
@Override public byte[] writeLine(KeyValuePair<PactInteger,CoordVector> pair){
  StringBuilder line=new StringBuilder();
  line.append(pair.getKey().getValue());
  for (  double coord : pair.getValue().getCoordinates()) {
    line.append('|');
    line.append(df.format(coord));
  }
  line.append('|');
  line.append('\n');
  return line.toString().getBytes();
}
Program: 56146
Project: 56146
Buggy source:
private void doWrite(SelectionKey key){
  final SocketChannel socketChannel=(SocketChannel)key.channel();
  final OutgoingConnection outgoingConnection=(OutgoingConnection)key.attachment();
  try {
    if (!outgoingConnection.write(socketChannel)) {
      outgoingConnection.closeConnection(socketChannel,key);
    }
  }
 catch (  IOException ioe) {
    outgoingConnection.reportTransmissionProblem(socketChannel,key,ioe);
  }
}

Fixed version (ground truth):
private void doWrite(SelectionKey key){
  final SocketChannel socketChannel=(SocketChannel)key.channel();
  final OutgoingConnection outgoingConnection=(OutgoingConnection)key.attachment();
  try {
    if (!outgoingConnection.write(socketChannel)) {
    }
  }
 catch (  IOException ioe) {
    outgoingConnection.reportTransmissionProblem(socketChannel,key,ioe);
  }
}