Program: 103458
Project: 103458
Buggy source:
/** 
 * Sets the chat session to associate to this chat panel.
 * @param chatSession the chat session to associate to this chat panel
 */
public void setChatSession(ChatSession chatSession){
  this.chatSession=chatSession;
  if ((this.chatSession != null) && this.chatSession.isContactListSupported()) {
    messagePane.remove(conversationPanel);
    TransparentPanel rightPanel=new TransparentPanel(new BorderLayout(5,5));
    Dimension chatContactPanelSize=new Dimension(150,100);
    rightPanel.setMinimumSize(chatContactPanelSize);
    rightPanel.setPreferredSize(chatContactPanelSize);
    this.chatContactListPanel=new ChatRoomMemberListPanel(this);
    this.chatContactListPanel.setOpaque(false);
    topSplitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    topSplitPane.setBorder(null);
    topSplitPane.setOneTouchExpandable(true);
    topSplitPane.setOpaque(false);
    topSplitPane.setResizeWeight(1.0D);
    ChatTransport chatTransport=chatSession.getCurrentChatTransport();
    JLabel localUserLabel=new JLabel(chatTransport.getProtocolProvider().getAccountID().getDisplayName());
    localUserLabel.setFont(localUserLabel.getFont().deriveFont(Font.BOLD));
    rightPanel.add(localUserLabel,BorderLayout.NORTH);
    rightPanel.add(chatContactListPanel,BorderLayout.CENTER);
    topSplitPane.setLeftComponent(conversationPanel);
    topSplitPane.setRightComponent(rightPanel);
    messagePane.setTopComponent(topSplitPane);
  }
 else {
    if (topSplitPane != null) {
      if (chatContactListPanel != null) {
        topSplitPane.remove(chatContactListPanel);
        chatContactListPanel=null;
      }
      this.messagePane.remove(topSplitPane);
      topSplitPane=null;
    }
    this.messagePane.setTopComponent(conversationPanel);
  }
  if (chatSession instanceof MetaContactChatSession) {
    if (subjectPanel != null) {
      this.remove(subjectPanel);
      subjectPanel=null;
      this.revalidate();
      this.repaint();
    }
    writeMessagePanel.setTransportSelectorBoxVisible(true);
    ActionMap amap=this.getActionMap();
    amap.put("String_Node_Str",new ChangeTransportAction());
    InputMap imap=this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_P,KeyEvent.CTRL_DOWN_MASK),"String_Node_Str");
  }
 else   if (chatSession instanceof ConferenceChatSession) {
    ConferenceChatSession confSession=(ConferenceChatSession)chatSession;
    writeMessagePanel.setTransportSelectorBoxVisible(false);
    confSession.addLocalUserRoleListener(this);
    confSession.addMemberRoleListener(this);
    subjectPanel=new ChatRoomSubjectPanel((ConferenceChatSession)chatSession);
    this.add(subjectPanel,BorderLayout.NORTH);
  }
  if (chatContactListPanel != null) {
    Iterator<ChatContact<?>> chatParticipants=chatSession.getParticipants();
    while (chatParticipants.hasNext())     chatContactListPanel.addContact(chatParticipants.next());
  }
}

Fixed version (ground truth):
/** 
 * Sets the chat session to associate to this chat panel.
 * @param chatSession the chat session to associate to this chat panel
 */
public void setChatSession(ChatSession chatSession){
  this.chatSession=chatSession;
  if ((this.chatSession != null) && this.chatSession.isContactListSupported()) {
    topPanel.remove(conversationPanel);
    TransparentPanel rightPanel=new TransparentPanel(new BorderLayout(5,5));
    Dimension chatContactPanelSize=new Dimension(150,100);
    rightPanel.setMinimumSize(chatContactPanelSize);
    rightPanel.setPreferredSize(chatContactPanelSize);
    this.chatContactListPanel=new ChatRoomMemberListPanel(this);
    this.chatContactListPanel.setOpaque(false);
    topSplitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    topSplitPane.setBorder(null);
    topSplitPane.setOneTouchExpandable(true);
    topSplitPane.setOpaque(false);
    topSplitPane.setResizeWeight(1.0D);
    ChatTransport chatTransport=chatSession.getCurrentChatTransport();
    JLabel localUserLabel=new JLabel(chatTransport.getProtocolProvider().getAccountID().getDisplayName());
    localUserLabel.setFont(localUserLabel.getFont().deriveFont(Font.BOLD));
    rightPanel.add(localUserLabel,BorderLayout.NORTH);
    rightPanel.add(chatContactListPanel,BorderLayout.CENTER);
    topSplitPane.setLeftComponent(conversationPanel);
    topSplitPane.setRightComponent(rightPanel);
    topPanel.add(topSplitPane);
  }
 else {
    if (topSplitPane != null) {
      if (chatContactListPanel != null) {
        topSplitPane.remove(chatContactListPanel);
        chatContactListPanel=null;
      }
      this.messagePane.remove(topSplitPane);
      topSplitPane=null;
    }
    topPanel.add(conversationPanel);
  }
  if (chatSession instanceof MetaContactChatSession) {
    if (subjectPanel != null) {
      this.remove(subjectPanel);
      subjectPanel=null;
      this.revalidate();
      this.repaint();
    }
    writeMessagePanel.setTransportSelectorBoxVisible(true);
    ActionMap amap=this.getActionMap();
    amap.put("String_Node_Str",new ChangeTransportAction());
    InputMap imap=this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_P,KeyEvent.CTRL_DOWN_MASK),"String_Node_Str");
  }
 else   if (chatSession instanceof ConferenceChatSession) {
    ConferenceChatSession confSession=(ConferenceChatSession)chatSession;
    writeMessagePanel.setTransportSelectorBoxVisible(false);
    confSession.addLocalUserRoleListener(this);
    confSession.addMemberRoleListener(this);
    subjectPanel=new ChatRoomSubjectPanel((ConferenceChatSession)chatSession);
    this.add(subjectPanel,BorderLayout.NORTH);
  }
  if (chatContactListPanel != null) {
    Iterator<ChatContact<?>> chatParticipants=chatSession.getParticipants();
    while (chatParticipants.hasNext())     chatContactListPanel.addContact(chatParticipants.next());
  }
}