Program: 104140
Project: 104140
Buggy source:
/** 
 * Handles the <tt>ActionEvent</tt>. Determines which menu item was selected and performs the appropriate operations.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem menuItem=(JMenuItem)e.getSource();
  String itemName=menuItem.getName();
  String itemText=menuItem.getText();
  Contact cont=null;
  if (itemName.startsWith(addSubcontactPrefix)) {
    ProtocolProviderService pps=mainFrame.getProtocolProviderForAccount(itemText);
    if (pps != null) {
      AddContactDialog dialog=new AddContactDialog(mainFrame,contactItem,pps);
      dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 250,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 100);
      dialog.showDialog();
    }
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    ContactListPane clistPanel=mainFrame.getContactListPanel();
    SwingUtilities.invokeLater(clistPanel.new RunMessageWindow(contactItem));
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    Contact defaultSmsContact=contactItem.getDefaultContact(OperationSetSmsMessaging.class);
    ContactListPane clistPanel=mainFrame.getContactListPanel();
    SwingUtilities.invokeLater(clistPanel.new RunMessageWindow(contactItem,defaultSmsContact,true));
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    cont=contactItem.getDefaultContact(OperationSetBasicTelephony.class);
    callContact(cont);
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    RenameContactDialog dialog=new RenameContactDialog(mainFrame,contactItem);
    dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 200,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 50);
    dialog.setVisible(true);
    dialog.requestFocusInFiled();
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    HistoryWindow history;
    HistoryWindowManager historyWindowManager=GuiActivator.getUIService().getHistoryWindowManager();
    if (historyWindowManager.containsHistoryWindowForContact(contactItem)) {
      history=historyWindowManager.getHistoryWindowForContact(contactItem);
      if (history.getState() == JFrame.ICONIFIED)       history.setState(JFrame.NORMAL);
      history.toFront();
    }
 else {
      history=new HistoryWindow(this.contactItem);
      historyWindowManager.addHistoryWindowForContact(contactItem,history);
      history.setVisible(true);
    }
  }
 else   if (itemName.startsWith(moveToPrefix)) {
    MetaContactGroup group=mainFrame.getGroupByID(itemName.substring(moveToPrefix.length()));
    try {
      if (group != null) {
        mainFrame.getContactList().moveMetaContact(contactItem,group);
      }
    }
 catch (    Exception ex) {
      new ErrorDialog(mainFrame,GuiActivator.getResources().getI18NString("String_Node_Str"),GuiActivator.getResources().getI18NString("String_Node_Str"),ex).showDialog();
    }
  }
 else   if (itemName.startsWith(removeContactPrefix)) {
    Contact contact=getContactFromMetaContact(itemName.substring(removeContactPrefix.length()));
    if (contact != null) {
      new RemoveContactThread(contact).start();
    }
 else {
      new RemoveAllContactsThread().start();
    }
  }
 else   if (itemName.startsWith(moveSubcontactPrefix)) {
    Contact contact=getContactFromMetaContact(itemName.substring(moveSubcontactPrefix.length()));
    guiContactList.addExcContactListListener(this);
    this.moveDialog=new MoveSubcontactMessageDialog(mainFrame,this);
    this.moveDialog.setVisible(true);
    if (contact != null) {
      this.contactToMove=contact;
    }
 else {
      this.moveAllContacts=true;
    }
  }
 else   if (itemName.startsWith(callContactPrefix)) {
    cont=getContactFromMetaContact(itemName.substring(callContactPrefix.length()));
    callContact(cont);
  }
}

Fixed version (ground truth):
/** 
 * Handles the <tt>ActionEvent</tt>. Determines which menu item was selected and performs the appropriate operations.
 */
public void actionPerformed(ActionEvent e){
  JMenuItem menuItem=(JMenuItem)e.getSource();
  String itemName=menuItem.getName();
  Contact cont=null;
  if (itemName.startsWith(addSubcontactPrefix)) {
    ProtocolProviderService pps=((ProviderAwareMenuItem)menuItem).getProvider();
    if (pps != null) {
      AddContactDialog dialog=new AddContactDialog(mainFrame,contactItem,pps);
      dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 250,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 100);
      dialog.showDialog();
    }
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    ContactListPane clistPanel=mainFrame.getContactListPanel();
    SwingUtilities.invokeLater(clistPanel.new RunMessageWindow(contactItem));
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    Contact defaultSmsContact=contactItem.getDefaultContact(OperationSetSmsMessaging.class);
    ContactListPane clistPanel=mainFrame.getContactListPanel();
    SwingUtilities.invokeLater(clistPanel.new RunMessageWindow(contactItem,defaultSmsContact,true));
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    cont=contactItem.getDefaultContact(OperationSetBasicTelephony.class);
    callContact(cont);
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    RenameContactDialog dialog=new RenameContactDialog(mainFrame,contactItem);
    dialog.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 200,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 50);
    dialog.setVisible(true);
    dialog.requestFocusInFiled();
  }
 else   if (itemName.equalsIgnoreCase("String_Node_Str")) {
    HistoryWindow history;
    HistoryWindowManager historyWindowManager=GuiActivator.getUIService().getHistoryWindowManager();
    if (historyWindowManager.containsHistoryWindowForContact(contactItem)) {
      history=historyWindowManager.getHistoryWindowForContact(contactItem);
      if (history.getState() == JFrame.ICONIFIED)       history.setState(JFrame.NORMAL);
      history.toFront();
    }
 else {
      history=new HistoryWindow(this.contactItem);
      historyWindowManager.addHistoryWindowForContact(contactItem,history);
      history.setVisible(true);
    }
  }
 else   if (itemName.startsWith(moveToPrefix)) {
    MetaContactGroup group=mainFrame.getGroupByID(itemName.substring(moveToPrefix.length()));
    try {
      if (group != null) {
        mainFrame.getContactList().moveMetaContact(contactItem,group);
      }
    }
 catch (    Exception ex) {
      new ErrorDialog(mainFrame,GuiActivator.getResources().getI18NString("String_Node_Str"),GuiActivator.getResources().getI18NString("String_Node_Str"),ex).showDialog();
    }
  }
 else   if (itemName.startsWith(removeContactPrefix)) {
    Contact contact=getContactFromMetaContact(itemName.substring(removeContactPrefix.length()));
    if (contact != null) {
      new RemoveContactThread(contact).start();
    }
 else {
      new RemoveAllContactsThread().start();
    }
  }
 else   if (itemName.startsWith(moveSubcontactPrefix)) {
    Contact contact=getContactFromMetaContact(itemName.substring(moveSubcontactPrefix.length()));
    guiContactList.addExcContactListListener(this);
    this.moveDialog=new MoveSubcontactMessageDialog(mainFrame,this);
    this.moveDialog.setVisible(true);
    if (contact != null) {
      this.contactToMove=contact;
    }
 else {
      this.moveAllContacts=true;
    }
  }
 else   if (itemName.startsWith(callContactPrefix)) {
    cont=getContactFromMetaContact(itemName.substring(callContactPrefix.length()));
    callContact(cont);
  }
}