Program: 85796
Project: 85796
Buggy source:
/** 
 * Called when a message is received from the server. Processes the given message and generates events based on its content.
 */
public void receiveMessage(Protos.TwoWayChannelMessage msg){
  lock.lock();
  try {
    checkState(connectionOpen);
    Protos.Error.Builder errorBuilder;
    CloseReason closeReason;
    try {
switch (msg.getType()) {
case SERVER_VERSION:
        checkState(step == InitStep.WAITING_FOR_VERSION_NEGOTIATION && msg.hasServerVersion());
      if (msg.getServerVersion().getMajor() != 0) {
        errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.NO_ACCEPTABLE_VERSION);
        closeReason=CloseReason.NO_ACCEPTABLE_VERSION;
        break;
      }
    log.info("String_Node_Str");
  step=InitStep.WAITING_FOR_INITIATE;
return;
case INITIATE:
checkState(step == InitStep.WAITING_FOR_INITIATE && msg.hasInitiate());
Protos.Initiate initiate=msg.getInitiate();
checkState(initiate.getExpireTimeSecs() > 0 && initiate.getMinAcceptedChannelSize() >= 0);
if (initiate.getExpireTimeSecs() > Utils.now().getTime() / 1000 + MAX_TIME_WINDOW) {
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.TIME_WINDOW_TOO_LARGE);
closeReason=CloseReason.TIME_WINDOW_TOO_LARGE;
break;
}
BigInteger minChannelSize=BigInteger.valueOf(initiate.getMinAcceptedChannelSize());
if (minChannelSize.compareTo(maxValue) > 0) {
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.CHANNEL_VALUE_TOO_LARGE);
closeReason=CloseReason.SERVER_REQUESTED_TOO_MUCH_VALUE;
break;
}
receiveInitiate(initiate,minChannelSize);
return;
case RETURN_REFUND:
receiveRefund(msg);
return;
case CHANNEL_OPEN:
receiveChannelOpen();
return;
case CLOSE:
conn.destroyConnection(CloseReason.SERVER_REQUESTED_CLOSE);
return;
case ERROR:
checkState(msg.hasError());
log.error("String_Node_Str",msg.getError().getCode().name(),msg.getError().hasExplanation() ? msg.getError().getExplanation() : "String_Node_Str");
conn.destroyConnection(CloseReason.REMOTE_SENT_ERROR);
return;
default :
log.error("String_Node_Str");
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.SYNTAX_ERROR);
closeReason=CloseReason.REMOTE_SENT_INVALID_MESSAGE;
break;
}
}
 catch (VerificationException e) {
log.error("String_Node_Str",e);
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.BAD_TRANSACTION).setExplanation(e.getMessage());
closeReason=CloseReason.REMOTE_SENT_INVALID_MESSAGE;
}
catch (ValueOutOfRangeException e) {
log.error("String_Node_Str",e);
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.BAD_TRANSACTION).setExplanation(e.getMessage());
closeReason=CloseReason.REMOTE_SENT_INVALID_MESSAGE;
}
catch (IllegalStateException e) {
log.error("String_Node_Str",e);
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.SYNTAX_ERROR);
closeReason=CloseReason.REMOTE_SENT_INVALID_MESSAGE;
}
conn.sendToServer(Protos.TwoWayChannelMessage.newBuilder().setError(errorBuilder).setType(Protos.TwoWayChannelMessage.MessageType.ERROR).build());
conn.destroyConnection(closeReason);
}
  finally {
lock.unlock();
}
}

Fixed version (ground truth):
/** 
 * Called when a message is received from the server. Processes the given message and generates events based on its content.
 */
public void receiveMessage(Protos.TwoWayChannelMessage msg){
  lock.lock();
  try {
    checkState(connectionOpen);
    Protos.Error.Builder errorBuilder;
    CloseReason closeReason;
    try {
switch (msg.getType()) {
case SERVER_VERSION:
        checkState(step == InitStep.WAITING_FOR_VERSION_NEGOTIATION && msg.hasServerVersion());
      if (msg.getServerVersion().getMajor() != 0) {
        errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.NO_ACCEPTABLE_VERSION);
        closeReason=CloseReason.NO_ACCEPTABLE_VERSION;
        break;
      }
    log.info("String_Node_Str");
  step=InitStep.WAITING_FOR_INITIATE;
return;
case INITIATE:
checkState(step == InitStep.WAITING_FOR_INITIATE && msg.hasInitiate());
Protos.Initiate initiate=msg.getInitiate();
checkState(initiate.getExpireTimeSecs() > 0 && initiate.getMinAcceptedChannelSize() >= 0);
if (initiate.getExpireTimeSecs() > Utils.now().getTime() / 1000 + MAX_TIME_WINDOW) {
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.TIME_WINDOW_TOO_LARGE);
closeReason=CloseReason.TIME_WINDOW_TOO_LARGE;
break;
}
BigInteger minChannelSize=BigInteger.valueOf(initiate.getMinAcceptedChannelSize());
if (maxValue.compareTo(minChannelSize) < 0) {
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.CHANNEL_VALUE_TOO_LARGE);
closeReason=CloseReason.SERVER_REQUESTED_TOO_MUCH_VALUE;
break;
}
receiveInitiate(initiate,maxValue);
return;
case RETURN_REFUND:
receiveRefund(msg);
return;
case CHANNEL_OPEN:
receiveChannelOpen();
return;
case CLOSE:
conn.destroyConnection(CloseReason.SERVER_REQUESTED_CLOSE);
return;
case ERROR:
checkState(msg.hasError());
log.error("String_Node_Str",msg.getError().getCode().name(),msg.getError().hasExplanation() ? msg.getError().getExplanation() : "String_Node_Str");
conn.destroyConnection(CloseReason.REMOTE_SENT_ERROR);
return;
default :
log.error("String_Node_Str");
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.SYNTAX_ERROR);
closeReason=CloseReason.REMOTE_SENT_INVALID_MESSAGE;
break;
}
}
 catch (VerificationException e) {
log.error("String_Node_Str",e);
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.BAD_TRANSACTION).setExplanation(e.getMessage());
closeReason=CloseReason.REMOTE_SENT_INVALID_MESSAGE;
}
catch (ValueOutOfRangeException e) {
log.error("String_Node_Str",e);
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.BAD_TRANSACTION).setExplanation(e.getMessage());
closeReason=CloseReason.REMOTE_SENT_INVALID_MESSAGE;
}
catch (IllegalStateException e) {
log.error("String_Node_Str",e);
errorBuilder=Protos.Error.newBuilder().setCode(Protos.Error.ErrorCode.SYNTAX_ERROR);
closeReason=CloseReason.REMOTE_SENT_INVALID_MESSAGE;
}
conn.sendToServer(Protos.TwoWayChannelMessage.newBuilder().setError(errorBuilder).setType(Protos.TwoWayChannelMessage.MessageType.ERROR).build());
conn.destroyConnection(closeReason);
}
  finally {
lock.unlock();
}
}