Program: 104105
Project: 104105
Buggy source:
/** 
 * Manages a mouse click over the contact list. When the left mouse button is clicked on a contact cell different things may happen depending on the contained component under the mouse. If the mouse is double clicked on the "contact name" the chat window is opened, configured to use the default protocol contact for the selected MetaContact. If the mouse is clicked on one of the protocol icons, the chat window is opened, configured to use the protocol contact corresponding to the given icon. When the right mouse button is clicked on a contact cell, the cell is selected and the <tt>ContactRightButtonMenu</tt> is opened. When the right mouse button is clicked on a group cell, the cell is selected and the <tt>GroupRightButtonMenu</tt> is opened. When the middle mouse button is clicked on a cell, the cell is selected.
 */
public void mouseClicked(MouseEvent e){
  int selectedIndex=this.getSelectedIndex();
  Object selectedValue=this.getSelectedValue();
  if (selectedIndex < 0)   return;
  ContactListCellRenderer renderer=(ContactListCellRenderer)this.getCellRenderer().getListCellRendererComponent(this,selectedValue,selectedIndex,true,true);
  Point selectedCellPoint=this.indexToLocation(selectedIndex);
  int translatedX=e.getX() - selectedCellPoint.x;
  if (selectedValue instanceof MetaContactGroup) {
    MetaContactGroup group=(MetaContactGroup)selectedValue;
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      groupRightButtonMenu=new GroupRightButtonMenu(mainFrame,group);
      SwingUtilities.convertPointToScreen(selectedCellPoint,this);
      groupRightButtonMenu.setInvoker(this);
      groupRightButtonMenu.setLocation(selectedCellPoint.x,selectedCellPoint.y + renderer.getHeight());
      groupRightButtonMenu.setVisible(true);
    }
 else     if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
      if (listModel.isGroupClosed(group))       listModel.openGroup(group);
 else       listModel.closeGroup(group);
      fireContactListEvent(group,ContactListEvent.GROUP_SELECTED,e.getClickCount());
      Component component=this.getHorizontalComponent(renderer,translatedX);
      if (component instanceof JPanel) {
        if (component.getName() != null && component.getName().equals("String_Node_Str")) {
          JPanel panel=(JPanel)component;
          int internalX=translatedX - (renderer.getWidth() - panel.getWidth() - 2);
          Component c=getHorizontalComponent(panel,internalX);
          if (c instanceof JLabel) {
            if (listModel.isGroupClosed(group)) {
              listModel.openGroup(group);
            }
 else {
              listModel.closeGroup(group);
            }
          }
        }
      }
    }
  }
  if (selectedValue instanceof MetaContact) {
    MetaContact contact=(MetaContact)selectedValue;
    Component component=this.getHorizontalComponent(renderer,translatedX);
    if (component instanceof JLabel) {
      if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
        contactRightButtonMenu=new ContactRightButtonMenu(this,contact);
        SwingUtilities.convertPointToScreen(selectedCellPoint,this);
        contactRightButtonMenu.setInvoker(this);
        contactRightButtonMenu.setLocation(selectedCellPoint.x,selectedCellPoint.y + renderer.getHeight());
        contactRightButtonMenu.setVisible(true);
      }
 else       if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0 && e.getClickCount() > 1) {
        fireContactListEvent(contact,ContactListEvent.CONTACT_SELECTED,e.getClickCount());
      }
    }
 else     if (component instanceof JButton) {
      SwingUtilities.invokeLater(new RunInfoWindow(selectedCellPoint,contact));
    }
 else     if (component instanceof JPanel) {
      if (component.getName() != null && component.getName().equals("String_Node_Str")) {
        JPanel panel=(JPanel)component;
        int internalX=translatedX - (renderer.getWidth() - panel.getWidth() - 2);
        Component c=getHorizontalComponent(panel,internalX);
        if (c instanceof ContactProtocolButton) {
          fireContactListEvent(contact,((ContactProtocolButton)c).getProtocolContact(),ContactListEvent.PROTOCOL_CONTACT_SELECTED);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Manages a mouse click over the contact list. When the left mouse button is clicked on a contact cell different things may happen depending on the contained component under the mouse. If the mouse is double clicked on the "contact name" the chat window is opened, configured to use the default protocol contact for the selected MetaContact. If the mouse is clicked on one of the protocol icons, the chat window is opened, configured to use the protocol contact corresponding to the given icon. When the right mouse button is clicked on a contact cell, the cell is selected and the <tt>ContactRightButtonMenu</tt> is opened. When the right mouse button is clicked on a group cell, the cell is selected and the <tt>GroupRightButtonMenu</tt> is opened. When the middle mouse button is clicked on a cell, the cell is selected.
 */
public void mouseClicked(MouseEvent e){
  int selectedIndex=this.getSelectedIndex();
  Object selectedValue=this.getSelectedValue();
  if (selectedIndex < 0)   return;
  ContactListCellRenderer renderer=(ContactListCellRenderer)this.getCellRenderer().getListCellRendererComponent(this,selectedValue,selectedIndex,true,true);
  Point selectedCellPoint=this.indexToLocation(selectedIndex);
  int translatedX=e.getX() - selectedCellPoint.x;
  if (selectedValue instanceof MetaContactGroup) {
    MetaContactGroup group=(MetaContactGroup)selectedValue;
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      groupRightButtonMenu=new GroupRightButtonMenu(mainFrame,group);
      SwingUtilities.convertPointToScreen(selectedCellPoint,this);
      groupRightButtonMenu.setInvoker(this);
      groupRightButtonMenu.setLocation(selectedCellPoint.x,selectedCellPoint.y + renderer.getHeight());
      groupRightButtonMenu.setVisible(true);
    }
 else     if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
      if (!disableOpenClose) {
        if (listModel.isGroupClosed(group))         listModel.openGroup(group);
 else         listModel.closeGroup(group);
      }
      fireContactListEvent(group,ContactListEvent.GROUP_SELECTED,e.getClickCount());
      if (!disableOpenClose) {
        Component component=this.getHorizontalComponent(renderer,translatedX);
        if (component instanceof JPanel) {
          if (component.getName() != null && component.getName().equals("String_Node_Str")) {
            JPanel panel=(JPanel)component;
            int internalX=translatedX - (renderer.getWidth() - panel.getWidth() - 2);
            Component c=getHorizontalComponent(panel,internalX);
            if (c instanceof JLabel) {
              if (listModel.isGroupClosed(group)) {
                listModel.openGroup(group);
              }
 else {
                listModel.closeGroup(group);
              }
            }
          }
        }
      }
    }
  }
  if (selectedValue instanceof MetaContact) {
    MetaContact contact=(MetaContact)selectedValue;
    Component component=this.getHorizontalComponent(renderer,translatedX);
    if (component instanceof JLabel) {
      if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
        contactRightButtonMenu=new ContactRightButtonMenu(this,contact);
        SwingUtilities.convertPointToScreen(selectedCellPoint,this);
        contactRightButtonMenu.setInvoker(this);
        contactRightButtonMenu.setLocation(selectedCellPoint.x,selectedCellPoint.y + renderer.getHeight());
        contactRightButtonMenu.setVisible(true);
      }
 else       if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0 && e.getClickCount() > 1) {
        fireContactListEvent(contact,ContactListEvent.CONTACT_SELECTED,e.getClickCount());
      }
    }
 else     if (component instanceof JButton) {
      SwingUtilities.invokeLater(new RunInfoWindow(selectedCellPoint,contact));
    }
 else     if (component instanceof JPanel) {
      if (component.getName() != null && component.getName().equals("String_Node_Str")) {
        JPanel panel=(JPanel)component;
        int internalX=translatedX - (renderer.getWidth() - panel.getWidth() - 2);
        Component c=getHorizontalComponent(panel,internalX);
        if (c instanceof ContactProtocolButton) {
          fireContactListEvent(contact,((ContactProtocolButton)c).getProtocolContact(),ContactListEvent.PROTOCOL_CONTACT_SELECTED);
        }
      }
    }
  }
}