Program: 103781
Project: 103781
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.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) {
    ContactNode contactNode=(ContactNode)lastComponent;
    fireContactListEvent(contactNode.getMetaContact(),ContactListEvent.CONTACT_CLICKED,e.getClickCount());
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      rightButtonMenu=new ContactRightButtonMenu(contactNode.getMetaContact(),this);
      openRightButtonMenu(e.getPoint());
    }
  }
 else   if (lastComponent instanceof GroupNode) {
    GroupNode groupNode=(GroupNode)lastComponent;
    fireContactListEvent(groupNode.getMetaContactGroup(),ContactListEvent.GROUP_CLICKED,e.getClickCount());
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      rightButtonMenu=new GroupRightButtonMenu(GuiActivator.getUIService().getMainFrame(),groupNode.getMetaContactGroup());
      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) {
    ContactNode contactNode=(ContactNode)lastComponent;
    fireContactListEvent(contactNode.getMetaContact(),ContactListEvent.CONTACT_CLICKED,e.getClickCount());
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      rightButtonMenu=new ContactRightButtonMenu(contactNode.getMetaContact(),this);
      openRightButtonMenu(e.getPoint());
    }
  }
 else   if (lastComponent instanceof GroupNode) {
    GroupNode groupNode=(GroupNode)lastComponent;
    fireContactListEvent(groupNode.getMetaContactGroup(),ContactListEvent.GROUP_CLICKED,e.getClickCount());
    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
      rightButtonMenu=new GroupRightButtonMenu(GuiActivator.getUIService().getMainFrame(),groupNode.getMetaContactGroup());
      openRightButtonMenu(e.getPoint());
    }
  }
  dispatchEventToButtons(e);
}