Program: 103038
Project: 103038
Buggy source:
/** 
 * Invoked when <tt>ChatRoomMemberPresenceChangeEvent</tt> are received. When a new <tt>ChatRoomMember</tt> has joined the chat adds it to the list of chat participants on the right of the chat window. When a <tt>ChatRoomMember</tt> has left or quit, or has being kicked it's removed from the chat window.
 * @param evt the <tt>ChatRoomMemberPresenceChangeEvent</tt> that notifiedus
 */
public void memberPresenceChanged(final ChatRoomMemberPresenceChangeEvent evt){
  if (!SwingUtilities.isEventDispatchThread()) {
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        memberPresenceChanged(evt);
      }
    }
);
    return;
  }
  ChatRoom sourceChatRoom=(ChatRoom)evt.getSource();
  if (!sourceChatRoom.equals(chatRoomWrapper.getChatRoom()))   return;
  String eventType=evt.getEventType();
  ChatRoomMember chatRoomMember=evt.getChatRoomMember();
  String statusMessage=null;
  if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_JOINED)) {
    ConferenceChatContact chatContact=new ConferenceChatContact(chatRoomMember);
synchronized (chatParticipants) {
      if (!chatParticipants.contains(chatContact))       chatParticipants.add(chatContact);
      sessionRenderer.addChatContact(chatContact);
    }
    ChatRoom room=chatRoomWrapper.getChatRoom();
    if (room != null) {
      room.updatePrivateContactPresenceStatus(chatRoomMember.getName());
    }
    if (!evt.isReasonUserList()) {
      statusMessage=GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{sourceChatRoom.getName()});
      sessionRenderer.updateChatContactStatus(chatContact,statusMessage);
    }
  }
 else   if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT) || eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_KICKED) || eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_QUIT)) {
    if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT)) {
      statusMessage=GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{sourceChatRoom.getName()});
    }
 else     if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_KICKED)) {
      statusMessage=GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{sourceChatRoom.getName()});
    }
 else     if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_QUIT)) {
      statusMessage=GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{sourceChatRoom.getName()});
    }
    for (    ChatContact<?> chatContact : chatParticipants) {
      if (chatContact.getDescriptor().equals(chatRoomMember)) {
        sessionRenderer.updateChatContactStatus(chatContact,statusMessage);
        sessionRenderer.removeChatContact(chatContact);
        ChatRoom room=chatRoomWrapper.getChatRoom();
        if (room != null) {
          room.updatePrivateContactPresenceStatus(chatRoomMember.getName());
        }
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Invoked when <tt>ChatRoomMemberPresenceChangeEvent</tt> are received. When a new <tt>ChatRoomMember</tt> has joined the chat adds it to the list of chat participants on the right of the chat window. When a <tt>ChatRoomMember</tt> has left or quit, or has being kicked it's removed from the chat window.
 * @param evt the <tt>ChatRoomMemberPresenceChangeEvent</tt> that notifiedus
 */
public void memberPresenceChanged(final ChatRoomMemberPresenceChangeEvent evt){
  if (!SwingUtilities.isEventDispatchThread()) {
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        memberPresenceChanged(evt);
      }
    }
);
    return;
  }
  ChatRoom sourceChatRoom=(ChatRoom)evt.getSource();
  if (!sourceChatRoom.equals(chatRoomWrapper.getChatRoom()))   return;
  String eventType=evt.getEventType();
  ChatRoomMember chatRoomMember=evt.getChatRoomMember();
  String statusMessage=null;
  if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_JOINED)) {
    ConferenceChatContact chatContact=new ConferenceChatContact(chatRoomMember);
synchronized (chatParticipants) {
      if (!chatParticipants.contains(chatContact))       chatParticipants.add(chatContact);
      sessionRenderer.addChatContact(chatContact);
    }
    ChatRoom room=chatRoomWrapper.getChatRoom();
    if (room != null) {
      room.updatePrivateContactPresenceStatus(chatRoomMember.getName());
    }
    if (!evt.isReasonUserList()) {
      statusMessage=GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{sourceChatRoom.getName()});
      sessionRenderer.updateChatContactStatus(chatContact,statusMessage);
    }
  }
 else   if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT) || eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_KICKED) || eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_QUIT)) {
    if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT)) {
      statusMessage=GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{sourceChatRoom.getName()});
    }
 else     if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_KICKED)) {
      statusMessage=GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{sourceChatRoom.getName()});
    }
 else     if (eventType.equals(ChatRoomMemberPresenceChangeEvent.MEMBER_QUIT)) {
      statusMessage=GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{sourceChatRoom.getName()});
    }
    ChatContact<?> contact=null;
    for (    ChatContact<?> chatContact : chatParticipants) {
      if (chatContact.getDescriptor().equals(chatRoomMember)) {
        contact=chatContact;
        sessionRenderer.updateChatContactStatus(chatContact,statusMessage);
        sessionRenderer.removeChatContact(chatContact);
        ChatRoom room=chatRoomWrapper.getChatRoom();
        if (room != null) {
          room.updatePrivateContactPresenceStatus(chatRoomMember.getName());
        }
        break;
      }
    }
    if (contact != null) {
synchronized (chatParticipants) {
        chatParticipants.remove(contact);
      }
    }
  }
}