Program: 104493
Project: 104493
Buggy source:
public void run(){
  PresenceStatus contactStatus=((ContactListModel)contactList.getModel()).getMetaContactStatus(this.contactItem);
  if (!Constants.TABBED_CHAT_WINDOW) {
    if (contactMsgWindows.containsKey(this.contactItem)) {
      ChatWindow msgWindow=(ChatWindow)contactMsgWindows.get(this.contactItem);
      if (msgWindow.getExtendedState() == JFrame.ICONIFIED)       msgWindow.setExtendedState(JFrame.NORMAL);
      msgWindow.setVisible(true);
    }
 else {
      ChatWindow msgWindow=new ChatWindow(mainFrame);
      contactMsgWindows.put(this.contactItem,msgWindow);
      ChatPanel chatPanel=msgWindow.createChat(this.contactItem,contactStatus,protocolContact);
      chatPanel.loadHistory();
      msgWindow.addChat(chatPanel);
      msgWindow.pack();
      msgWindow.setVisible(true);
      msgWindow.getCurrentChatPanel().requestFocusInWriteArea();
    }
  }
 else {
    if (tabbedChatWindow == null) {
      tabbedChatWindow=new ChatWindow(mainFrame);
      tabbedChatWindow.addWindowListener(new WindowAdapter(){
        public void windowClosing(        WindowEvent e){
          tabbedChatWindow=null;
        }
      }
);
    }
    Hashtable contactTabsTable=tabbedChatWindow.getContactChatsTable();
    if (contactTabsTable.get(this.contactItem.getMetaUID()) == null) {
      ChatPanel chatPanel=tabbedChatWindow.createChat(this.contactItem,contactStatus,protocolContact);
      chatPanel.loadHistory();
      tabbedChatWindow.addChatTab(chatPanel);
      if (tabbedChatWindow.getTabCount() > 1) {
        tabbedChatWindow.setSelectedContactTab(this.contactItem);
      }
      if (tabbedChatWindow.getExtendedState() == JFrame.ICONIFIED)       tabbedChatWindow.setExtendedState(JFrame.NORMAL);
      tabbedChatWindow.setVisible(true);
      tabbedChatWindow.getCurrentChatPanel().requestFocusInWriteArea();
    }
 else {
      if (tabbedChatWindow.getTabCount() > 1) {
        tabbedChatWindow.setSelectedContactTab(this.contactItem);
      }
      if (tabbedChatWindow.getExtendedState() == JFrame.ICONIFIED)       tabbedChatWindow.setExtendedState(JFrame.NORMAL);
      tabbedChatWindow.setVisible(true);
      tabbedChatWindow.getCurrentChatPanel().requestFocusInWriteArea();
    }
  }
}

Fixed version (ground truth):
public void run(){
  PresenceStatus contactStatus=((ContactListModel)contactList.getModel()).getMetaContactStatus(this.contactItem);
  if (!Constants.TABBED_CHAT_WINDOW) {
    if (contactMsgWindows.containsKey(this.contactItem)) {
      ChatWindow msgWindow=(ChatWindow)contactMsgWindows.get(this.contactItem);
      if (msgWindow.isVisible())       msgWindow.toFront();
 else       msgWindow.setVisible(true);
    }
 else {
      ChatWindow msgWindow=new ChatWindow(mainFrame);
      contactMsgWindows.put(this.contactItem,msgWindow);
      ChatPanel chatPanel=msgWindow.createChat(this.contactItem,contactStatus,protocolContact);
      chatPanel.loadHistory();
      msgWindow.addChat(chatPanel);
      msgWindow.pack();
      msgWindow.setVisible(true);
      msgWindow.getCurrentChatPanel().requestFocusInWriteArea();
    }
  }
 else {
    if (tabbedChatWindow == null) {
      tabbedChatWindow=new ChatWindow(mainFrame);
      tabbedChatWindow.addWindowListener(new WindowAdapter(){
        public void windowClosing(        WindowEvent e){
          tabbedChatWindow=null;
        }
      }
);
    }
    Hashtable contactTabsTable=tabbedChatWindow.getContactChatsTable();
    if (contactTabsTable.get(this.contactItem.getMetaUID()) == null) {
      ChatPanel chatPanel=tabbedChatWindow.createChat(this.contactItem,contactStatus,protocolContact);
      chatPanel.loadHistory();
      tabbedChatWindow.addChatTab(chatPanel);
      if (tabbedChatWindow.getTabCount() > 1) {
        tabbedChatWindow.setSelectedContactTab(this.contactItem);
      }
      if (tabbedChatWindow.isVisible())       tabbedChatWindow.toFront();
 else       tabbedChatWindow.setVisible(true);
      tabbedChatWindow.getCurrentChatPanel().requestFocusInWriteArea();
    }
 else {
      if (tabbedChatWindow.getTabCount() > 1) {
        tabbedChatWindow.setSelectedContactTab(this.contactItem);
      }
      if (tabbedChatWindow.isVisible())       tabbedChatWindow.toFront();
 else       tabbedChatWindow.setVisible(true);
      tabbedChatWindow.getCurrentChatPanel().requestFocusInWriteArea();
    }
  }
}