Program: 104015
Project: 104015
Buggy source:
/** 
 * Called by joustsim as a notification of the fact that the server has sent the specified group and that it is actually a member from our contact list. We copy the group locally and generate the corresponding sip-communicator events
 * @param list the BuddyList where this is happening.
 * @param oldItems we don't use it
 * @param newItems we don't use it
 * @param group the new Group that has been added
 * @param buddies the members of the new group.
 */
public void groupAdded(BuddyList list,List oldItems,List newItems,Group group,List buddies){
  logger.trace("String_Node_Str" + group.getName());
  logger.trace("String_Node_Str" + buddies);
  ContactGroupIcqImpl newGroup=findContactGroup(group.getName());
  if (newGroup == null) {
    newGroup=new ContactGroupIcqImpl((MutableGroup)group,buddies,ServerStoredContactListIcqImpl.this,true);
    rootGroup.addSubGroup(newGroup);
    fireGroupEvent(newGroup,ServerStoredGroupEvent.GROUP_CREATED_EVENT);
  }
 else {
    List newContacts=new ArrayList();
    List<ContactIcqImpl> deletedContacts=new ArrayList<ContactIcqImpl>();
    newGroup.updateGroup((MutableGroup)group,buddies,newContacts,deletedContacts);
    fireGroupEvent(newGroup,ServerStoredGroupEvent.GROUP_RESOLVED_EVENT);
    Iterator<ContactIcqImpl> deletedContactsIter=deletedContacts.iterator();
    while (deletedContactsIter.hasNext()) {
      ContactIcqImpl contact=(ContactIcqImpl)deletedContactsIter.next();
      fireContactRemoved(newGroup,contact);
    }
    Iterator<ContactIcqImpl> contactsIter=newGroup.contacts();
    while (contactsIter.hasNext()) {
      ContactIcqImpl contact=(ContactIcqImpl)contactsIter.next();
      if (newContacts.contains(contact))       fireContactAdded(newGroup,contact);
 else       fireContactResolved(newGroup,contact);
    }
  }
  for (int i=0; i < buddies.size(); i++)   ((Buddy)buddies.get(i)).addBuddyListener(jsimBuddyListener);
  group.addGroupListener(jsimGroupChangeListener);
}

Fixed version (ground truth):
/** 
 * Called by joustsim as a notification of the fact that the server has sent the specified group and that it is actually a member from our contact list. We copy the group locally and generate the corresponding sip-communicator events
 * @param list the BuddyList where this is happening.
 * @param oldItems we don't use it
 * @param newItems we don't use it
 * @param group the new Group that has been added
 * @param buddies the members of the new group.
 */
public void groupAdded(BuddyList list,List oldItems,List newItems,Group group,List buddies){
  logger.trace("String_Node_Str" + group.getName());
  logger.trace("String_Node_Str" + buddies);
  ContactGroupIcqImpl newGroup=findContactGroup(group.getName());
  if (newGroup == null) {
    newGroup=new ContactGroupIcqImpl((MutableGroup)group,buddies,ServerStoredContactListIcqImpl.this,true);
    rootGroup.addSubGroup(newGroup);
    fireGroupEvent(newGroup,ServerStoredGroupEvent.GROUP_CREATED_EVENT);
  }
 else {
    List<Contact> newContacts=new ArrayList<Contact>();
    List<ContactIcqImpl> deletedContacts=new ArrayList<ContactIcqImpl>();
    newGroup.updateGroup((MutableGroup)group,buddies,newContacts,deletedContacts);
    fireGroupEvent(newGroup,ServerStoredGroupEvent.GROUP_RESOLVED_EVENT);
    Iterator<ContactIcqImpl> deletedContactsIter=deletedContacts.iterator();
    while (deletedContactsIter.hasNext()) {
      ContactIcqImpl contact=(ContactIcqImpl)deletedContactsIter.next();
      fireContactRemoved(newGroup,contact);
    }
    Iterator<Contact> contactsIter=newGroup.contacts();
    while (contactsIter.hasNext()) {
      ContactIcqImpl contact=(ContactIcqImpl)contactsIter.next();
      if (newContacts.contains(contact))       fireContactAdded(newGroup,contact);
 else       fireContactResolved(newGroup,contact);
    }
  }
  for (int i=0; i < buddies.size(); i++)   ((Buddy)buddies.get(i)).addBuddyListener(jsimBuddyListener);
  group.addGroupListener(jsimGroupChangeListener);
}