Program: 104138
Project: 104138
Buggy source:
/** 
 * Initializes the menu, by adding all containing menu items.
 */
private void init(){
  this.moveToMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.GROUPS_16x16_ICON)));
  this.addSubcontactMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.ADD_CONTACT_16x16_ICON)));
  this.removeContactMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.DELETE_16x16_ICON)));
  this.moveSubcontactMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MOVE_CONTACT_ICON)));
  this.callContactMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.CALL_16x16_ICON)));
  Iterator providers=mainFrame.getProtocolProviders();
  if (providers.hasNext()) {
    JLabel infoLabel=new JLabel(GuiActivator.getResources().getI18NString("String_Node_Str"));
    infoLabel.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
    infoLabel.setFont(infoLabel.getFont().deriveFont(Font.BOLD));
    this.addSubcontactMenu.add(infoLabel);
    this.addSubcontactMenu.addSeparator();
  }
  while (providers.hasNext()) {
    ProtocolProviderService pps=(ProtocolProviderService)providers.next();
    String protocolName=pps.getProtocolName();
    JMenuItem menuItem=new JMenuItem(pps.getAccountID().getDisplayName(),new ImageIcon(ImageLoader.getAccountStatusImage(pps)));
    menuItem.setName(addSubcontactPrefix + protocolName);
    menuItem.addActionListener(this);
    this.addSubcontactMenu.add(menuItem);
  }
  Iterator<MetaContactGroup> groups=this.mainFrame.getAllGroups();
  if (groups.hasNext()) {
    JLabel infoLabel=new JLabel(GuiActivator.getResources().getI18NString("String_Node_Str"));
    infoLabel.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
    infoLabel.setFont(infoLabel.getFont().deriveFont(Font.BOLD));
    this.moveToMenu.add(infoLabel);
    this.moveToMenu.addSeparator();
  }
  while (groups.hasNext()) {
    MetaContactGroup group=groups.next();
    JMenuItem menuItem=new JMenuItem(group.getGroupName());
    menuItem.setName(moveToPrefix + group.getMetaUID());
    menuItem.addActionListener(this);
    this.moveToMenu.add(menuItem);
  }
  Iterator<Contact> contacts=contactItem.getContacts();
  if (contactItem.getContactCount() > 1) {
    JMenuItem allItem=new JMenuItem(allContactsString);
    JMenuItem allItem1=new JMenuItem(allContactsString);
    allItem.addActionListener(this);
    allItem1.addActionListener(this);
    allItem.setName(removeContactPrefix + "String_Node_Str");
    allItem1.setName(moveSubcontactPrefix + "String_Node_Str");
    this.removeContactMenu.add(allItem);
    this.moveSubcontactMenu.add(allItem1);
    this.removeContactMenu.addSeparator();
    this.moveSubcontactMenu.addSeparator();
  }
  while (contacts.hasNext()) {
    Contact contact=contacts.next();
    ProtocolProviderService protocolProvider=contact.getProtocolProvider();
    String contactDisplayName=contact.getDisplayName();
    JMenuItem contactItem=new JMenuItem(contactDisplayName);
    JMenuItem contactItem1=new JMenuItem(contactDisplayName);
    Icon protocolIcon=new ImageIcon(createContactStatusImage(contact));
    contactItem.setIcon(protocolIcon);
    contactItem1.setIcon(protocolIcon);
    contactItem.setName(removeContactPrefix + contact.getAddress() + protocolProvider.getProtocolName());
    contactItem1.setName(moveSubcontactPrefix + contact.getAddress() + protocolProvider.getProtocolName());
    contactItem.addActionListener(this);
    contactItem1.addActionListener(this);
    this.removeContactMenu.add(contactItem);
    this.moveSubcontactMenu.add(contactItem1);
    if (contact.getProtocolProvider().getOperationSet(OperationSetBasicTelephony.class) != null) {
      JMenuItem callContactItem=new JMenuItem(contactDisplayName);
      callContactItem.setIcon(protocolIcon);
      callContactItem.setName(callContactPrefix + contact.getAddress() + protocolProvider.getProtocolName());
      callContactItem.addActionListener(this);
      this.callContactMenu.add(callContactItem);
    }
    protocolProvider.getOperationSet(OperationSetWebContactInfo.class);
  }
  this.add(sendMessageItem);
  this.add(sendSmsItem);
  if (callContactMenu.getItemCount() > 1) {
    this.add(callContactMenu);
  }
 else {
    this.add(callItem);
  }
  this.add(sendFileItem);
  this.addSeparator();
  this.add(moveToMenu);
  this.add(moveSubcontactMenu);
  this.addSeparator();
  this.add(addSubcontactMenu);
  this.addSeparator();
  this.add(removeContactMenu);
  this.add(renameContactItem);
  this.addSeparator();
  this.add(viewHistoryItem);
  this.initPluginComponents();
  this.sendMessageItem.setName("String_Node_Str");
  this.callItem.setName("String_Node_Str");
  this.sendSmsItem.setName("String_Node_Str");
  this.sendFileItem.setName("String_Node_Str");
  this.moveToMenu.setName("String_Node_Str");
  this.addSubcontactMenu.setName("String_Node_Str");
  this.renameContactItem.setName("String_Node_Str");
  this.viewHistoryItem.setName("String_Node_Str");
  this.sendMessageItem.addActionListener(this);
  this.callItem.addActionListener(this);
  this.sendSmsItem.addActionListener(this);
  this.sendFileItem.addActionListener(this);
  this.renameContactItem.addActionListener(this);
  this.viewHistoryItem.addActionListener(this);
  if (contactItem.getDefaultContact(OperationSetFileTransfer.class) == null)   this.sendFileItem.setEnabled(false);
  if (contactItem.getDefaultContact(OperationSetBasicTelephony.class) == null)   this.callItem.setEnabled(false);
  if (contactItem.getDefaultContact(OperationSetBasicInstantMessaging.class) == null)   this.sendMessageItem.setEnabled(false);
  if (contactItem.getDefaultContact(OperationSetSmsMessaging.class) == null)   this.sendSmsItem.setEnabled(false);
}

Fixed version (ground truth):
/** 
 * Initializes the menu, by adding all containing menu items.
 */
private void init(){
  this.moveToMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.GROUPS_16x16_ICON)));
  this.addSubcontactMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.ADD_CONTACT_16x16_ICON)));
  this.removeContactMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.DELETE_16x16_ICON)));
  this.moveSubcontactMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MOVE_CONTACT_ICON)));
  this.callContactMenu.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.CALL_16x16_ICON)));
  Iterator<ProtocolProviderService> providers=mainFrame.getProtocolProviders();
  if (providers.hasNext()) {
    JLabel infoLabel=new JLabel(GuiActivator.getResources().getI18NString("String_Node_Str"));
    infoLabel.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
    infoLabel.setFont(infoLabel.getFont().deriveFont(Font.BOLD));
    this.addSubcontactMenu.add(infoLabel);
    this.addSubcontactMenu.addSeparator();
  }
  while (providers.hasNext()) {
    ProtocolProviderService pps=(ProtocolProviderService)providers.next();
    String protocolName=pps.getProtocolName();
    ProviderAwareMenuItem menuItem=new ProviderAwareMenuItem(pps,pps.getAccountID().getDisplayName(),new ImageIcon(ImageLoader.getAccountStatusImage(pps)));
    menuItem.setName(addSubcontactPrefix + protocolName);
    menuItem.addActionListener(this);
    this.addSubcontactMenu.add(menuItem);
  }
  Iterator<MetaContactGroup> groups=this.mainFrame.getAllGroups();
  if (groups.hasNext()) {
    JLabel infoLabel=new JLabel(GuiActivator.getResources().getI18NString("String_Node_Str"));
    infoLabel.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
    infoLabel.setFont(infoLabel.getFont().deriveFont(Font.BOLD));
    this.moveToMenu.add(infoLabel);
    this.moveToMenu.addSeparator();
  }
  while (groups.hasNext()) {
    MetaContactGroup group=groups.next();
    JMenuItem menuItem=new JMenuItem(group.getGroupName());
    menuItem.setName(moveToPrefix + group.getMetaUID());
    menuItem.addActionListener(this);
    this.moveToMenu.add(menuItem);
  }
  Iterator<Contact> contacts=contactItem.getContacts();
  if (contactItem.getContactCount() > 1) {
    JMenuItem allItem=new JMenuItem(allContactsString);
    JMenuItem allItem1=new JMenuItem(allContactsString);
    allItem.addActionListener(this);
    allItem1.addActionListener(this);
    allItem.setName(removeContactPrefix + "String_Node_Str");
    allItem1.setName(moveSubcontactPrefix + "String_Node_Str");
    this.removeContactMenu.add(allItem);
    this.moveSubcontactMenu.add(allItem1);
    this.removeContactMenu.addSeparator();
    this.moveSubcontactMenu.addSeparator();
  }
  while (contacts.hasNext()) {
    Contact contact=contacts.next();
    ProtocolProviderService protocolProvider=contact.getProtocolProvider();
    String contactDisplayName=contact.getDisplayName();
    JMenuItem contactItem=new JMenuItem(contactDisplayName);
    JMenuItem contactItem1=new JMenuItem(contactDisplayName);
    Icon protocolIcon=new ImageIcon(createContactStatusImage(contact));
    contactItem.setIcon(protocolIcon);
    contactItem1.setIcon(protocolIcon);
    contactItem.setName(removeContactPrefix + contact.getAddress() + protocolProvider.getProtocolName());
    contactItem1.setName(moveSubcontactPrefix + contact.getAddress() + protocolProvider.getProtocolName());
    contactItem.addActionListener(this);
    contactItem1.addActionListener(this);
    this.removeContactMenu.add(contactItem);
    this.moveSubcontactMenu.add(contactItem1);
    if (contact.getProtocolProvider().getOperationSet(OperationSetBasicTelephony.class) != null) {
      JMenuItem callContactItem=new JMenuItem(contactDisplayName);
      callContactItem.setIcon(protocolIcon);
      callContactItem.setName(callContactPrefix + contact.getAddress() + protocolProvider.getProtocolName());
      callContactItem.addActionListener(this);
      this.callContactMenu.add(callContactItem);
    }
    protocolProvider.getOperationSet(OperationSetWebContactInfo.class);
  }
  this.add(sendMessageItem);
  this.add(sendSmsItem);
  if (callContactMenu.getItemCount() > 1) {
    this.add(callContactMenu);
  }
 else {
    this.add(callItem);
  }
  this.add(sendFileItem);
  this.addSeparator();
  this.add(moveToMenu);
  this.add(moveSubcontactMenu);
  this.addSeparator();
  this.add(addSubcontactMenu);
  this.addSeparator();
  this.add(removeContactMenu);
  this.add(renameContactItem);
  this.addSeparator();
  this.add(viewHistoryItem);
  this.initPluginComponents();
  this.sendMessageItem.setName("String_Node_Str");
  this.callItem.setName("String_Node_Str");
  this.sendSmsItem.setName("String_Node_Str");
  this.sendFileItem.setName("String_Node_Str");
  this.moveToMenu.setName("String_Node_Str");
  this.addSubcontactMenu.setName("String_Node_Str");
  this.renameContactItem.setName("String_Node_Str");
  this.viewHistoryItem.setName("String_Node_Str");
  this.sendMessageItem.addActionListener(this);
  this.callItem.addActionListener(this);
  this.sendSmsItem.addActionListener(this);
  this.sendFileItem.addActionListener(this);
  this.renameContactItem.addActionListener(this);
  this.viewHistoryItem.addActionListener(this);
  if (contactItem.getDefaultContact(OperationSetFileTransfer.class) == null)   this.sendFileItem.setEnabled(false);
  if (contactItem.getDefaultContact(OperationSetBasicTelephony.class) == null)   this.callItem.setEnabled(false);
  if (contactItem.getDefaultContact(OperationSetBasicInstantMessaging.class) == null)   this.sendMessageItem.setEnabled(false);
  if (contactItem.getDefaultContact(OperationSetSmsMessaging.class) == null)   this.sendSmsItem.setEnabled(false);
}