Program: 104338
Project: 104338
Buggy source:
/** 
 * Adds all protocol supported operation sets.
 * @param protocolProvider The protocol provider.
 */
public void addProtocolSupportedOperationSets(ProtocolProviderService protocolProvider){
  Map supportedOperationSets=protocolProvider.getSupportedOperationSets();
  String ppOpSetClassName=OperationSetPersistentPresence.class.getName();
  String pOpSetClassName=OperationSetPresence.class.getName();
  if (supportedOperationSets.containsKey(ppOpSetClassName) || supportedOperationSets.containsKey(pOpSetClassName)) {
    OperationSetPresence presence=(OperationSetPresence)supportedOperationSets.get(ppOpSetClassName);
    if (presence == null) {
      presence=(OperationSetPresence)supportedOperationSets.get(pOpSetClassName);
    }
    presence.addProviderPresenceStatusListener(new GUIProviderPresenceStatusListener());
    presence.addContactPresenceStatusListener(new GUIContactPresenceStatusListener());
  }
  String imOpSetClassName=OperationSetBasicInstantMessaging.class.getName();
  if (supportedOperationSets.containsKey(imOpSetClassName)) {
    OperationSetBasicInstantMessaging im=(OperationSetBasicInstantMessaging)supportedOperationSets.get(imOpSetClassName);
    im.addMessageListener(getContactListPanel());
  }
  String tnOpSetClassName=OperationSetTypingNotifications.class.getName();
  if (supportedOperationSets.containsKey(tnOpSetClassName)) {
    OperationSetTypingNotifications tn=(OperationSetTypingNotifications)supportedOperationSets.get(tnOpSetClassName);
    tn.addTypingNotificationsListener(this.getContactListPanel());
  }
  String telOpSetClassName=OperationSetBasicTelephony.class.getName();
  if (supportedOperationSets.containsKey(telOpSetClassName)) {
    OperationSetBasicTelephony telephony=(OperationSetBasicTelephony)supportedOperationSets.get(telOpSetClassName);
    telephony.addCallListener(callManager);
    this.getContactListPanel().getContactList().addListSelectionListener(callManager);
    this.tabbedPane.addChangeListener(callManager);
  }
  String multiChatClassName=OperationSetMultiUserChat.class.getName();
  if (supportedOperationSets.containsKey(multiChatClassName)) {
    OperationSetMultiUserChat multiUserChat=(OperationSetMultiUserChat)supportedOperationSets.get(multiChatClassName);
    multiUserChat.addInvitationListener(multiUserChatManager);
    multiUserChat.addInvitationRejectionListener(multiUserChatManager);
    multiUserChat.addPresenceListener(multiUserChatManager);
    this.getChatRoomsListPanel().getChatRoomsList().addChatServer(protocolProvider,multiUserChat);
  }
  String smsOpSetClassName=OperationSetSmsMessaging.class.getName();
  if (supportedOperationSets.containsKey(smsOpSetClassName)) {
    OperationSetSmsMessaging smsOpSet=(OperationSetSmsMessaging)supportedOperationSets.get(smsOpSetClassName);
    smsOpSet.addMessageListener(getContactListPanel());
  }
}

Fixed version (ground truth):
/** 
 * Adds all protocol supported operation sets.
 * @param protocolProvider The protocol provider.
 */
public void addProtocolSupportedOperationSets(ProtocolProviderService protocolProvider){
  Map supportedOperationSets=protocolProvider.getSupportedOperationSets();
  String ppOpSetClassName=OperationSetPersistentPresence.class.getName();
  String pOpSetClassName=OperationSetPresence.class.getName();
  if (supportedOperationSets.containsKey(ppOpSetClassName) || supportedOperationSets.containsKey(pOpSetClassName)) {
    OperationSetPresence presence=(OperationSetPresence)supportedOperationSets.get(ppOpSetClassName);
    if (presence == null) {
      presence=(OperationSetPresence)supportedOperationSets.get(pOpSetClassName);
    }
    presence.addProviderPresenceStatusListener(new GUIProviderPresenceStatusListener());
    presence.addContactPresenceStatusListener(new GUIContactPresenceStatusListener());
  }
  String imOpSetClassName=OperationSetBasicInstantMessaging.class.getName();
  if (supportedOperationSets.containsKey(imOpSetClassName)) {
    OperationSetBasicInstantMessaging im=(OperationSetBasicInstantMessaging)supportedOperationSets.get(imOpSetClassName);
    im.addMessageListener(getContactListPanel());
  }
  String tnOpSetClassName=OperationSetTypingNotifications.class.getName();
  if (supportedOperationSets.containsKey(tnOpSetClassName)) {
    OperationSetTypingNotifications tn=(OperationSetTypingNotifications)supportedOperationSets.get(tnOpSetClassName);
    tn.addTypingNotificationsListener(this.getContactListPanel());
  }
  String telOpSetClassName=OperationSetBasicTelephony.class.getName();
  if (supportedOperationSets.containsKey(telOpSetClassName)) {
    OperationSetBasicTelephony telephony=(OperationSetBasicTelephony)supportedOperationSets.get(telOpSetClassName);
    telephony.addCallListener(callManager);
    this.getContactListPanel().getContactList().addListSelectionListener(callManager);
    this.tabbedPane.addChangeListener(callManager);
  }
  String multiChatClassName=OperationSetMultiUserChat.class.getName();
  if (supportedOperationSets.containsKey(multiChatClassName)) {
    OperationSetMultiUserChat multiUserChat=(OperationSetMultiUserChat)supportedOperationSets.get(multiChatClassName);
    multiUserChat.addInvitationListener(multiUserChatManager);
    multiUserChat.addInvitationRejectionListener(multiUserChatManager);
    multiUserChat.addPresenceListener(multiUserChatManager);
    this.getChatRoomsListPanel().getChatRoomsList().addChatServer(protocolProvider,multiUserChat);
  }
}