Program: 104464
Project: 104464
Buggy source:
/** 
 * When a message is received determines whether to open a new chat window or chat window tab, or to indicate that a message is received from a contact which already has an open chat. When the chat is found checks if in mode "Auto popup enabled" and if this is the case shows the message in the appropriate chat panel.
 * @param evt the event containing details on the received message
 */
public void messageReceived(MessageReceivedEvent evt){
  logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
  Contact protocolContact=evt.getSourceContact();
  Date date=evt.getTimestamp();
  Message message=evt.getSourceMessage();
  MetaContact metaContact=mainFrame.getContactList().findMetaContactByContact(protocolContact);
  ChatPanel chatPanel;
  if (!Constants.TABBED_CHAT_WINDOW) {
    if (chatWindowManager.containsContactChat(metaContact)) {
      chatPanel=chatWindowManager.getContactChat(metaContact);
      chatPanel.processMessage(protocolContact.getDisplayName(),date,Constants.INCOMING_MESSAGE,message.getContent());
    }
 else {
      chatPanel=chatWindowManager.createChat(metaContact,protocolContact);
      chatPanel.processMessage(protocolContact.getDisplayName(),date,Constants.INCOMING_MESSAGE,message.getContent());
    }
  }
 else {
    if (!chatWindowManager.containsContactChat(metaContact)) {
      logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
      chatPanel=chatWindowManager.createChat(metaContact,protocolContact);
      logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
      chatPanel.processMessage(protocolContact.getDisplayName(),date,Constants.INCOMING_MESSAGE,message.getContent());
    }
 else {
      logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
      chatPanel=chatWindowManager.getContactChat(metaContact);
      logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
      chatPanel.processMessage(protocolContact.getDisplayName(),date,Constants.INCOMING_MESSAGE,message.getContent());
    }
  }
  chatWindowManager.openChat(chatPanel,false);
  GuiActivator.getAudioNotifier().createAudio(Sounds.INCOMING_MESSAGE).play();
  if (!chatPanel.getProtocolContact().getProtocolProvider().equals(protocolContact.getProtocolProvider())) {
    chatPanel.setProtocolContact(protocolContact);
  }
}

Fixed version (ground truth):
/** 
 * When a message is received determines whether to open a new chat window or chat window tab, or to indicate that a message is received from a contact which already has an open chat. When the chat is found checks if in mode "Auto popup enabled" and if this is the case shows the message in the appropriate chat panel.
 * @param evt the event containing details on the received message
 */
public void messageReceived(MessageReceivedEvent evt){
  logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
  Contact protocolContact=evt.getSourceContact();
  Date date=evt.getTimestamp();
  Message message=evt.getSourceMessage();
  MetaContact metaContact=mainFrame.getContactList().findMetaContactByContact(protocolContact);
  ChatPanel chatPanel;
  if (!Constants.TABBED_CHAT_WINDOW) {
    if (chatWindowManager.containsContactChat(metaContact)) {
      chatPanel=chatWindowManager.getContactChat(metaContact);
      chatPanel.processMessage(protocolContact.getDisplayName(),date,Constants.INCOMING_MESSAGE,message.getContent());
    }
 else {
      chatPanel=chatWindowManager.createChat(metaContact,protocolContact,message.getMessageUID());
      chatPanel.processMessage(protocolContact.getDisplayName(),date,Constants.INCOMING_MESSAGE,message.getContent());
    }
  }
 else {
    if (!chatWindowManager.containsContactChat(metaContact)) {
      logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
      chatPanel=chatWindowManager.createChat(metaContact,protocolContact,message.getMessageUID());
      logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
      chatPanel.processMessage(protocolContact.getDisplayName(),date,Constants.INCOMING_MESSAGE,message.getContent());
    }
 else {
      logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
      chatPanel=chatWindowManager.getContactChat(metaContact);
      logger.trace("String_Node_Str" + evt.getSourceContact().getAddress());
      chatPanel.processMessage(protocolContact.getDisplayName(),date,Constants.INCOMING_MESSAGE,message.getContent());
    }
  }
  chatWindowManager.openChat(chatPanel,false);
  GuiActivator.getAudioNotifier().createAudio(Sounds.INCOMING_MESSAGE).play();
  if (!chatPanel.getProtocolContact().getProtocolProvider().equals(protocolContact.getProtocolProvider())) {
    chatPanel.setProtocolContact(protocolContact);
  }
}