Program: 95025
Project: 95025
Buggy source:
protected void doJoin(final String target,final String key){
  ChatRoom room=(ChatRoom)rooms.get(target);
  if (room != null && room.isConnected()) {
    room.setSelected();
    return;
  }
  IChatRoomInfo roomInfo=chatRoomManager.getChatRoomInfo(target);
  if (roomInfo == null)   return;
 else {
    try {
      final IChatRoomContainer chatRoomContainer=roomInfo.createChatRoomContainer();
      final ChatRoom chatroomview=new ChatRoom(chatRoomContainer,new Manager(tabFolder,target));
      chatRoomContainer.addMessageListener(new IIMMessageListener(){
        public void handleMessageEvent(        IIMMessageEvent messageEvent){
          if (messageEvent instanceof IChatRoomMessageEvent) {
            IChatRoomMessage m=((IChatRoomMessageEvent)messageEvent).getChatRoomMessage();
            chatroomview.handleMessage(m.getFromID(),m.getMessage());
          }
        }
      }
);
      chatRoomContainer.addChatRoomParticipantListener(new IChatRoomParticipantListener(){
        public void handlePresence(        ID fromID,        IPresence presence){
          chatroomview.handlePresence(fromID,presence);
        }
        public void handleArrivedInChat(        ID participant){
          chatroomview.handleJoin(participant);
        }
        public void handleDepartedFromChat(        ID participant){
          chatroomview.handleLeave(participant);
        }
      }
);
      chatRoomContainer.addListener(new IContainerListener(){
        public void handleEvent(        IContainerEvent evt){
          if (evt instanceof IContainerDisconnectedEvent) {
            chatroomview.disconnected();
          }
        }
      }
);
      Display.getDefault().asyncExec(new Runnable(){
        public void run(){
          try {
            chatRoomContainer.connect(IDFactory.getDefault().createID(chatRoomContainer.getConnectNamespace(),target),ConnectContextFactory.createPasswordConnectContext(key));
            rooms.put(target,chatroomview);
          }
 catch (          Exception e) {
            e.printStackTrace();
          }
        }
      }
);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
protected void doJoin(final String target,final String key){
  ChatRoom room=(ChatRoom)rooms.get(target);
  if (room != null && room.isConnected()) {
    room.setSelected();
    return;
  }
  IChatRoomInfo roomInfo=chatRoomManager.getChatRoomInfo(target);
  if (roomInfo == null)   return;
 else {
    try {
      final IChatRoomContainer chatRoomContainer=roomInfo.createChatRoomContainer();
      final ChatRoom chatroomview=new ChatRoom(chatRoomContainer,new Manager(tabFolder,target));
      chatRoomContainer.addMessageListener(new IIMMessageListener(){
        public void handleMessageEvent(        IIMMessageEvent messageEvent){
          if (messageEvent instanceof IChatRoomMessageEvent) {
            IChatRoomMessage m=((IChatRoomMessageEvent)messageEvent).getChatRoomMessage();
            chatroomview.handleMessage(m.getFromID(),m.getMessage());
          }
        }
      }
);
      chatRoomContainer.addChatRoomParticipantListener(new IChatRoomParticipantListener(){
        public void handlePresence(        ID fromID,        IPresence presence){
          chatroomview.handlePresence(fromID,presence);
        }
        public void handleArrivedInChat(        ID participant){
        }
        public void handleDepartedFromChat(        ID participant){
        }
      }
);
      chatRoomContainer.addListener(new IContainerListener(){
        public void handleEvent(        IContainerEvent evt){
          if (evt instanceof IContainerDisconnectedEvent) {
            chatroomview.disconnected();
          }
        }
      }
);
      Display.getDefault().asyncExec(new Runnable(){
        public void run(){
          try {
            chatRoomContainer.connect(IDFactory.getDefault().createID(chatRoomContainer.getConnectNamespace(),target),ConnectContextFactory.createPasswordConnectContext(key));
            rooms.put(target,chatroomview);
          }
 catch (          Exception e) {
            e.printStackTrace();
          }
        }
      }
);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}