Program: 4575
Project: 4575
Buggy source:
/** 
 * The handler for all message types.  Processes a message based on the  message type.
 * @param msg the <tt>Message</tt> received
 * @param datagram the <tt>DatagramPacket</tt> containing the IP and port of the client node
 */
public void handleUDPMessage(Message msg,DatagramPacket datagram){
  msg.hop();
  InetAddress address=datagram.getAddress();
  int port=datagram.getPort();
  ReplyHandler handler=new UDPReplyHandler(address,port);
  if (msg instanceof QueryRequest) {
    if (hasValidQueryKey(address,port,(QueryRequest)msg)) {
      sendAcknowledgement(datagram,msg.getGUID());
      if (!handleUDPQueryRequestPossibleDuplicate((QueryRequest)msg,handler)) {
        ReceivedMessageStatHandler.UDP_DUPLICATE_QUERIES.addMessage(msg);
      }
    }
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_QUERY_REQUESTS.addMessage(msg);
  }
 else   if (msg instanceof QueryReply) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_QUERY_REPLIES.addMessage(msg);
    handleQueryReply((QueryReply)msg,handler);
  }
 else   if (msg instanceof PingRequest) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_PING_REQUESTS.addMessage(msg);
    handleUDPPingRequestPossibleDuplicate((PingRequest)msg,handler,datagram);
  }
 else   if (msg instanceof PingReply) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_PING_REPLIES.addMessage(msg);
    handleUDPPingReply((PingReply)msg,handler,address,port);
  }
 else   if (msg instanceof PushRequest) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_PUSH_REQUESTS.addMessage(msg);
    handlePushRequest((PushRequest)msg,handler);
  }
 else   if (msg instanceof LimeACKVendorMessage) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_LIME_ACK.addMessage(msg);
    handleLimeACKMessage((LimeACKVendorMessage)msg,datagram);
  }
}

Fixed version (ground truth):
/** 
 * The handler for all message types.  Processes a message based on the  message type.
 * @param msg the <tt>Message</tt> received
 * @param datagram the <tt>DatagramPacket</tt> containing the IP and port of the client node
 */
public void handleUDPMessage(Message msg,DatagramPacket datagram){
  msg.hop();
  InetAddress address=datagram.getAddress();
  int port=datagram.getPort();
  if (!NetworkUtils.isValidAddress(address) || !NetworkUtils.isValidPort(port))   return;
  ReplyHandler handler=new UDPReplyHandler(address,port);
  if (msg instanceof QueryRequest) {
    if (hasValidQueryKey(address,port,(QueryRequest)msg)) {
      sendAcknowledgement(datagram,msg.getGUID());
      if (!handleUDPQueryRequestPossibleDuplicate((QueryRequest)msg,handler)) {
        ReceivedMessageStatHandler.UDP_DUPLICATE_QUERIES.addMessage(msg);
      }
    }
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_QUERY_REQUESTS.addMessage(msg);
  }
 else   if (msg instanceof QueryReply) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_QUERY_REPLIES.addMessage(msg);
    handleQueryReply((QueryReply)msg,handler);
  }
 else   if (msg instanceof PingRequest) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_PING_REQUESTS.addMessage(msg);
    handleUDPPingRequestPossibleDuplicate((PingRequest)msg,handler,datagram);
  }
 else   if (msg instanceof PingReply) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_PING_REPLIES.addMessage(msg);
    handleUDPPingReply((PingReply)msg,handler,address,port);
  }
 else   if (msg instanceof PushRequest) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_PUSH_REQUESTS.addMessage(msg);
    handlePushRequest((PushRequest)msg,handler);
  }
 else   if (msg instanceof LimeACKVendorMessage) {
    if (RECORD_STATS)     ReceivedMessageStatHandler.UDP_LIME_ACK.addMessage(msg);
    handleLimeACKMessage((LimeACKVendorMessage)msg,datagram);
  }
}