Program: 105062
Project: 105062
Buggy source:
/** 
 * Handles control packet.
 * @param data raw packet data that arrived on control PPID.
 * @param sid SCTP stream id on which the data has arrived.
 */
private synchronized void onCtrlPacket(byte[] data,int sid) throws IOException {
  java.nio.ByteBuffer buffer=java.nio.ByteBuffer.wrap(data);
  int messageType=buffer.get();
  if (messageType == MSG_CHANNEL_ACK) {
    logger.info(getEndpoint().getID() + "String_Node_Str" + sid);
    WebRtcDataStream channel=channels.get(sid);
    if (channel != null) {
      if (!channel.isAcknowledged()) {
        channel.ackReceived();
        notifyChannelOpened(channel);
      }
 else {
        logger.warn("String_Node_Str" + sid);
      }
    }
 else {
      logger.error("String_Node_Str" + sid);
    }
  }
 else   if (messageType == MSG_OPEN_CHANNEL) {
    int channelType=buffer.get();
    int priority=buffer.getShort();
    long reliability=buffer.getInt();
    int labelLength=buffer.getShort();
    int protocolLength=buffer.getShort();
    byte[] labelRaw=new byte[labelLength];
    buffer.get(labelRaw);
    String label=new String(labelRaw);
    byte[] protocolRaw=new byte[protocolLength];
    buffer.get(protocolRaw);
    String protocol=new String(protocolRaw);
    logger.info("String_Node_Str" + getEndpoint().getID() + "String_Node_Str"+ "String_Node_Str"+ sid+ "String_Node_Str"+ channelType+ "String_Node_Str"+ priority+ "String_Node_Str"+ reliability+ "String_Node_Str"+ label+ "String_Node_Str"+ protocol);
    if (channels.containsKey(sid)) {
      logger.error("String_Node_Str" + sid + "String_Node_Str");
    }
    WebRtcDataStream newChannel=new WebRtcDataStream(sctpSocket,sid,label,true);
    channels.put(sid,newChannel);
    sendOpenChannelAck(sid);
    notifyChannelOpened(newChannel);
  }
 else {
    logger.error("String_Node_Str" + messageType);
  }
}

Fixed version (ground truth):
/** 
 * Handles control packet.
 * @param data raw packet data that arrived on control PPID.
 * @param sid SCTP stream id on which the data has arrived.
 */
private synchronized void onCtrlPacket(byte[] data,int sid) throws IOException {
  ByteBuffer buffer=ByteBuffer.wrap(data);
  int messageType=0xFF & buffer.get();
  if (messageType == MSG_CHANNEL_ACK) {
    logger.info(getEndpoint().getID() + "String_Node_Str" + sid);
    WebRtcDataStream channel=channels.get(sid);
    if (channel != null) {
      if (!channel.isAcknowledged()) {
        channel.ackReceived();
        notifyChannelOpened(channel);
      }
 else {
        logger.warn("String_Node_Str" + sid);
      }
    }
 else {
      logger.error("String_Node_Str" + sid);
    }
  }
 else   if (messageType == MSG_OPEN_CHANNEL) {
    int channelType=0xFF & buffer.get();
    int priority=0xFFFF & buffer.getShort();
    long reliability=0xFFFFFFFFL & buffer.getInt();
    int labelLength=0xFFFF & buffer.getShort();
    int protocolLength=0xFFFF & buffer.getShort();
    String label;
    String protocol;
    if (labelLength == 0) {
      label="String_Node_Str";
    }
 else {
      byte[] labelBytes=new byte[labelLength];
      buffer.get(labelBytes);
      label=new String(labelBytes,"String_Node_Str");
    }
    if (protocolLength == 0) {
      protocol="String_Node_Str";
    }
 else {
      byte[] protocolBytes=new byte[protocolLength];
      buffer.get(protocolBytes);
      protocol=new String(protocolBytes,"String_Node_Str");
    }
    if (logger.isInfoEnabled()) {
      logger.info("String_Node_Str" + getEndpoint().getID() + "String_Node_Str"+ sid+ "String_Node_Str"+ channelType+ "String_Node_Str"+ priority+ "String_Node_Str"+ reliability+ "String_Node_Str"+ label+ "String_Node_Str"+ protocol);
    }
    if (channels.containsKey(sid)) {
      logger.error("String_Node_Str" + sid + "String_Node_Str");
    }
    WebRtcDataStream newChannel=new WebRtcDataStream(sctpSocket,sid,label,true);
    channels.put(sid,newChannel);
    sendOpenChannelAck(sid);
    notifyChannelOpened(newChannel);
  }
 else {
    logger.error("String_Node_Str" + messageType);
  }
}