Program: 103465
Project: 103465
Buggy source:
/** 
 * 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.
 * @param e the <tt>MouseEvent</tt> that notified us of the press
 */
public void mousePressed(MouseEvent e){
  if (!isGroupClickConsumed) {
    for (    MouseListener listener : originalMouseListeners)     listener.mousePressed(e);
  }
  TreePath path=this.getPathForLocation(e.getX(),e.getY());
  if (path == null)   return;
  if (!path.equals(getSelectionPath()) && (e.getModifiers() & InputEvent.BUTTON1_MASK) != 0 || (e.getModifiers() & InputEvent.BUTTON2_MASK) != 0 || (e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
    this.setSelectionPath(path);
  }
  Object lastComponent=path.getLastPathComponent();
  if (!(lastComponent instanceof TreeNode))   return;
  if (lastComponent instanceof ContactNode) {
    UIContact uiContact=((ContactNode)lastComponent).getContactDescriptor();
    fireContactListEvent(uiContact,ContactListEvent.CONTACT_CLICKED,e.getClickCount());
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      rightButtonMenu=uiContact.getRightButtonMenu();
      openRightButtonMenu(e.getPoint());
    }
  }
 else   if (lastComponent instanceof GroupNode) {
    UIGroup uiGroup=((GroupNode)lastComponent).getGroupDescriptor();
    fireContactListEvent(uiGroup,ContactListEvent.GROUP_CLICKED,e.getClickCount());
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      rightButtonMenu=uiGroup.getRightButtonMenu();
      openRightButtonMenu(e.getPoint());
    }
  }
  dispatchEventToButtons(e);
}

Fixed version (ground truth):
/** 
 * 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.
 * @param e the <tt>MouseEvent</tt> that notified us of the press
 */
public void mousePressed(MouseEvent e){
  if (!isGroupClickConsumed) {
    for (    MouseListener listener : originalMouseListeners)     listener.mousePressed(e);
  }
  TreePath path=this.getPathForLocation(e.getX(),e.getY());
  if (path == null)   return;
  if (!path.equals(getSelectionPath()) && (e.getModifiers() & InputEvent.BUTTON1_MASK) != 0 || (e.getModifiers() & InputEvent.BUTTON2_MASK) != 0 || (e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
    this.setSelectionPath(path);
  }
  Object lastComponent=path.getLastPathComponent();
  if (!(lastComponent instanceof TreeNode))   return;
  if (lastComponent instanceof ContactNode) {
    UIContact uiContact=((ContactNode)lastComponent).getContactDescriptor();
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      rightButtonMenu=uiContact.getRightButtonMenu();
      openRightButtonMenu(e.getPoint());
    }
  }
 else   if (lastComponent instanceof GroupNode) {
    UIGroup uiGroup=((GroupNode)lastComponent).getGroupDescriptor();
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      rightButtonMenu=uiGroup.getRightButtonMenu();
      openRightButtonMenu(e.getPoint());
    }
  }
  dispatchEventToButtons(e);
}