Program: 104461
Project: 104461
Buggy source:
/** 
 * Adds all protocol supported operation sets.
 * @param protocolProvider The protocol provider.
 */
public void addProtocolSupportedOperationSets(ProtocolProviderService protocolProvider){
  Map supportedOperationSets=protocolProvider.getSupportedOperationSets();
  this.protocolSupportedOperationSets.put(protocolProvider,supportedOperationSets);
  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);
    }
    this.protocolPresenceSets.put(protocolProvider,presence);
    presence.addProviderPresenceStatusListener(new GUIProviderPresenceStatusListener());
    presence.addContactPresenceStatusListener(new GUIContactPresenceStatusListener());
  }
  String imOpSetClassName=OperationSetBasicInstantMessaging.class.getName();
  if (supportedOperationSets.containsKey(imOpSetClassName)) {
    OperationSetBasicInstantMessaging im=(OperationSetBasicInstantMessaging)supportedOperationSets.get(imOpSetClassName);
    this.imOperationSets.put(protocolProvider,im);
    im.addMessageListener(getContactListPanel());
  }
  String tnOpSetClassName=OperationSetTypingNotifications.class.getName();
  if (supportedOperationSets.containsKey(tnOpSetClassName)) {
    OperationSetTypingNotifications tn=(OperationSetTypingNotifications)supportedOperationSets.get(tnOpSetClassName);
    this.tnOperationSets.put(protocolProvider,tn);
    tn.addTypingNotificationsListener(this.getContactListPanel());
  }
  String wciOpSetClassName=OperationSetWebContactInfo.class.getName();
  if (supportedOperationSets.containsKey(wciOpSetClassName)) {
    OperationSetWebContactInfo wContactInfo=(OperationSetWebContactInfo)supportedOperationSets.get(wciOpSetClassName);
    this.webContactInfoOperationSets.put(protocolProvider,wContactInfo);
  }
  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);
    this.protocolTelephonySets.put(protocolProvider,telephony);
  }
}

Fixed version (ground truth):
/** 
 * Adds all protocol supported operation sets.
 * @param protocolProvider The protocol provider.
 */
public void addProtocolSupportedOperationSets(ProtocolProviderService protocolProvider){
  Map supportedOperationSets=protocolProvider.getSupportedOperationSets();
  this.protocolSupportedOperationSets.put(protocolProvider,supportedOperationSets);
  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);
    }
    this.protocolPresenceSets.put(protocolProvider,presence);
    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 wciOpSetClassName=OperationSetWebContactInfo.class.getName();
  if (supportedOperationSets.containsKey(wciOpSetClassName)) {
    OperationSetWebContactInfo wContactInfo=(OperationSetWebContactInfo)supportedOperationSets.get(wciOpSetClassName);
    this.webContactInfoOperationSets.put(protocolProvider,wContactInfo);
  }
  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);
    this.protocolTelephonySets.put(protocolProvider,telephony);
  }
}