Program: 87779
Project: 87779
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void queueTransferEnvelope(final TransferEnvelope transferEnvelope){
  final int sequenceNumber=transferEnvelope.getSequenceNumber();
  AbstractEvent eventToSend=null;
  if (ReceiverNotFoundEvent.isReceiverNotFoundEvent(transferEnvelope)) {
    return;
  }
synchronized (this.queuedEnvelopes) {
    if (this.destroyCalled) {
      final Buffer buffer=transferEnvelope.getBuffer();
      if (buffer != null) {
        buffer.recycleBuffer();
      }
      return;
    }
    final int expectedSequenceNumber=this.lastReceivedEnvelope + 1;
    if (sequenceNumber != expectedSequenceNumber) {
      if (sequenceNumber > expectedSequenceNumber) {
        if (expectedSequenceNumber > 0) {
          this.byteBufferedInputChannel.reportIOException(new IOException("String_Node_Str" + expectedSequenceNumber + "String_Node_Str"+ sequenceNumber));
          this.envelopeConsumptionTracker.reportEnvelopeAvailability(this.byteBufferedInputChannel);
        }
      }
 else {
        eventToSend=lookForCloseEvent(transferEnvelope);
        if (eventToSend == null) {
          eventToSend=new UnexpectedEnvelopeEvent(expectedSequenceNumber - 1);
        }
      }
      LOG.warn("String_Node_Str" + getChannelID() + "String_Node_Str"+ expectedSequenceNumber+ "String_Node_Str"+ sequenceNumber);
      final Buffer buffer=transferEnvelope.getBuffer();
      if (buffer != null) {
        buffer.recycleBuffer();
      }
    }
 else {
      this.queuedEnvelopes.add(transferEnvelope);
      this.lastReceivedEnvelope=sequenceNumber;
    }
  }
  this.envelopeConsumptionTracker.reportEnvelopeAvailability(this.byteBufferedInputChannel);
  if (eventToSend != null) {
    try {
      transferEventToOutputChannel(eventToSend);
    }
 catch (    Exception e) {
      LOG.error(StringUtils.stringifyException(e));
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void queueTransferEnvelope(final TransferEnvelope transferEnvelope){
  final int sequenceNumber=transferEnvelope.getSequenceNumber();
  AbstractEvent eventToSend=null;
  if (ReceiverNotFoundEvent.isReceiverNotFoundEvent(transferEnvelope)) {
    return;
  }
synchronized (this.queuedEnvelopes) {
    if (this.destroyCalled) {
      final Buffer buffer=transferEnvelope.getBuffer();
      if (buffer != null) {
        buffer.recycleBuffer();
      }
      return;
    }
    final int expectedSequenceNumber=this.lastReceivedEnvelope + 1;
    if (sequenceNumber != expectedSequenceNumber) {
      if (sequenceNumber > expectedSequenceNumber) {
        if (expectedSequenceNumber > 0) {
          this.byteBufferedInputChannel.reportIOException(new IOException("String_Node_Str" + expectedSequenceNumber + "String_Node_Str"+ sequenceNumber));
          this.byteBufferedInputChannel.checkForNetworkEvents();
        }
      }
 else {
        eventToSend=lookForCloseEvent(transferEnvelope);
        if (eventToSend == null) {
          eventToSend=new UnexpectedEnvelopeEvent(expectedSequenceNumber - 1);
        }
      }
      LOG.warn("String_Node_Str" + getChannelID() + "String_Node_Str"+ expectedSequenceNumber+ "String_Node_Str"+ sequenceNumber);
      final Buffer buffer=transferEnvelope.getBuffer();
      if (buffer != null) {
        buffer.recycleBuffer();
      }
    }
 else {
      this.queuedEnvelopes.add(transferEnvelope);
      this.lastReceivedEnvelope=sequenceNumber;
      this.envelopeConsumptionTracker.reportEnvelopeAvailability(this.byteBufferedInputChannel);
    }
  }
  if (eventToSend != null) {
    try {
      transferEventToOutputChannel(eventToSend);
    }
 catch (    Exception e) {
      LOG.error(StringUtils.stringifyException(e));
    }
  }
}