Program: 104080
Project: 104080
Buggy source:
/** 
 * The method is called by a ProtocolProvider implementation whenver a change in the registration state of the corresponding provider had occurred.
 * @param evt ProviderStatusChangeEvent the event describing the statuschange.
 */
public void registrationStateChanged(RegistrationStateChangeEvent evt){
  logger.debug("String_Node_Str" + evt.getOldState() + "String_Node_Str"+ evt.getNewState());
  if (evt.getNewState() == RegistrationState.REGISTERED) {
    parentProvider.getConnection().getRoster().addRosterListener(new ContactChangesListener());
    fireProviderPresenceStatusChangeEvent(currentStatus,parentProvider.getJabberStatusEnum().getStatus(JabberStatusEnum.AVAILABLE));
    ssContactList.init();
  }
 else   if (evt.getNewState() == RegistrationState.UNREGISTERED || evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED || evt.getNewState() == RegistrationState.CONNECTION_FAILED) {
    PresenceStatus oldStatus=currentStatus;
    PresenceStatus offlineStatus=parentProvider.getJabberStatusEnum().getStatus(JabberStatusEnum.OFFLINE);
    currentStatus=offlineStatus;
    fireProviderPresenceStatusChangeEvent(oldStatus,currentStatus);
    Iterator groupsIter=getServerStoredContactListRoot().subgroups();
    while (groupsIter.hasNext()) {
      ContactGroupJabberImpl group=(ContactGroupJabberImpl)groupsIter.next();
      Iterator contactsIter=group.contacts();
      while (contactsIter.hasNext()) {
        ContactJabberImpl contact=(ContactJabberImpl)contactsIter.next();
        PresenceStatus oldContactStatus=contact.getPresenceStatus();
        if (!oldContactStatus.isOnline())         continue;
        contact.updatePresenceStatus(offlineStatus);
        fireContactPresenceStatusChangeEvent(contact,contact.getParentContactGroup(),oldContactStatus,offlineStatus);
      }
    }
    Iterator contactsIter=getServerStoredContactListRoot().contacts();
    while (contactsIter.hasNext()) {
      ContactJabberImpl contact=(ContactJabberImpl)contactsIter.next();
      PresenceStatus oldContactStatus=contact.getPresenceStatus();
      if (!oldContactStatus.isOnline())       continue;
      contact.updatePresenceStatus(offlineStatus);
      fireContactPresenceStatusChangeEvent(contact,contact.getParentContactGroup(),oldContactStatus,offlineStatus);
    }
  }
}

Fixed version (ground truth):
/** 
 * The method is called by a ProtocolProvider implementation whenver a change in the registration state of the corresponding provider had occurred.
 * @param evt ProviderStatusChangeEvent the event describing the statuschange.
 */
public void registrationStateChanged(RegistrationStateChangeEvent evt){
  logger.debug("String_Node_Str" + evt.getOldState() + "String_Node_Str"+ evt.getNewState());
  if (evt.getNewState() == RegistrationState.REGISTERED) {
    parentProvider.getConnection().getRoster().addRosterListener(new ContactChangesListener());
    fireProviderPresenceStatusChangeEvent(currentStatus,parentProvider.getJabberStatusEnum().getStatus(JabberStatusEnum.AVAILABLE));
    ssContactList.init();
  }
 else   if (evt.getNewState() == RegistrationState.UNREGISTERED || evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED || evt.getNewState() == RegistrationState.CONNECTION_FAILED) {
    PresenceStatus oldStatus=currentStatus;
    PresenceStatus offlineStatus=parentProvider.getJabberStatusEnum().getStatus(JabberStatusEnum.OFFLINE);
    currentStatus=offlineStatus;
    fireProviderPresenceStatusChangeEvent(oldStatus,currentStatus);
    Iterator<ContactGroup> groupsIter=getServerStoredContactListRoot().subgroups();
    while (groupsIter.hasNext()) {
      ContactGroup group=groupsIter.next();
      Iterator<Contact> contactsIter=group.contacts();
      while (contactsIter.hasNext()) {
        ContactJabberImpl contact=(ContactJabberImpl)contactsIter.next();
        PresenceStatus oldContactStatus=contact.getPresenceStatus();
        if (!oldContactStatus.isOnline())         continue;
        contact.updatePresenceStatus(offlineStatus);
        fireContactPresenceStatusChangeEvent(contact,contact.getParentContactGroup(),oldContactStatus,offlineStatus);
      }
    }
    Iterator<Contact> contactsIter=getServerStoredContactListRoot().contacts();
    while (contactsIter.hasNext()) {
      ContactJabberImpl contact=(ContactJabberImpl)contactsIter.next();
      PresenceStatus oldContactStatus=contact.getPresenceStatus();
      if (!oldContactStatus.isOnline())       continue;
      contact.updatePresenceStatus(offlineStatus);
      fireContactPresenceStatusChangeEvent(contact,contact.getParentContactGroup(),oldContactStatus,offlineStatus);
    }
  }
}