Program: 102941
Project: 102941
Buggy source:
/** 
 * Join a particular chat room. Issue a join channel IRC operation and wait for the join operation to complete (either successfully or failing).
 * @param chatroom The chatroom to join.
 * @param password Optionally, a password that may be required for somechannels.
 * @throws OperationFailedException failed to join the chat room
 */
public void join(final ChatRoomIrcImpl chatroom,final String password) throws OperationFailedException {
  if (!isConnected())   throw new IllegalStateException("String_Node_Str");
  if (chatroom == null)   throw new IllegalArgumentException("String_Node_Str");
  if (password == null)   throw new IllegalArgumentException("String_Node_Str");
  if (this.joined.containsKey(chatroom.getIdentifier()) || chatroom.isPrivate()) {
    return;
  }
  LOGGER.trace("String_Node_Str" + chatroom.getIdentifier());
  final Result<Object,Exception> joinSignal=new Result<Object,Exception>();
synchronized (joinSignal) {
    LOGGER.trace("String_Node_Str");
    this.irc.joinChannel(chatroom.getIdentifier(),password,new Callback<IRCChannel>(){
      @Override public void onSuccess(      IRCChannel channel){
        LOGGER.trace("String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
        ChatRoomIrcImpl actualChatRoom=chatroom;
synchronized (joinSignal) {
          try {
            if (!channel.getName().equals(actualChatRoom.getIdentifier())) {
              actualChatRoom=new ChatRoomIrcImpl(channel.getName(),IrcStack.this.provider);
              MessageIrcImpl message=new MessageIrcImpl("String_Node_Str" + channel.getName(),"String_Node_Str","String_Node_Str",null);
              IrcStack.this.provider.getMUC().registerChatRoomInstance(actualChatRoom);
              chatroom.fireMessageReceivedEvent(message,null,new Date(),MessageReceivedEvent.SYSTEM_MESSAGE_RECEIVED);
            }
            IrcStack.this.joined.put(actualChatRoom.getIdentifier(),actualChatRoom);
            IrcStack.this.irc.addListener(new ChatRoomListener(actualChatRoom));
            IRCTopic topic=channel.getTopic();
            actualChatRoom.updateSubject(topic.getValue());
            for (            IRCUser user : channel.getUsers()) {
              ChatRoomMemberRole role=ChatRoomMemberRole.SILENT_MEMBER;
              Set<IRCUserStatus> statuses=channel.getStatusesForUser(user);
              for (              IRCUserStatus status : statuses) {
                role=convertMemberMode(status.getChanModeType().charValue());
              }
              if (IrcStack.this.getNick().equals(user.getNick())) {
                actualChatRoom.prepUserRole(role);
              }
 else {
                ChatRoomMemberIrcImpl member=new ChatRoomMemberIrcImpl(IrcStack.this.provider,actualChatRoom,user.getNick(),role);
                actualChatRoom.addChatRoomMember(member.getContactAddress(),member);
              }
            }
          }
  finally {
            IrcStack.this.provider.getMUC().fireLocalUserPresenceEvent(actualChatRoom,LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_JOINED,null);
            LOGGER.trace("String_Node_Str" + "String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
            joinSignal.setDone();
            joinSignal.notifyAll();
          }
        }
      }
      @Override public void onFailure(      Exception e){
        LOGGER.trace("String_Node_Str" + "String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
synchronized (joinSignal) {
          try {
            MessageIrcImpl message=new MessageIrcImpl("String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str"+ e.getMessage()+ "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
            chatroom.fireMessageReceivedEvent(message,null,new Date(),MessageReceivedEvent.SYSTEM_MESSAGE_RECEIVED);
          }
  finally {
            LOGGER.trace("String_Node_Str" + "String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
            joinSignal.setDone(e);
            joinSignal.notifyAll();
          }
        }
      }
    }
);
    try {
      while (!joinSignal.isDone()) {
        LOGGER.trace("String_Node_Str");
        joinSignal.wait();
      }
      LOGGER.trace("String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
      Exception e=joinSignal.getException();
      if (e != null) {
        throw new OperationFailedException(e.getMessage(),OperationFailedException.CHAT_ROOM_NOT_JOINED,e);
      }
    }
 catch (    InterruptedException e) {
      throw new OperationFailedException(e.getMessage(),OperationFailedException.INTERNAL_ERROR,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Join a particular chat room. Issue a join channel IRC operation and wait for the join operation to complete (either successfully or failing).
 * @param chatroom The chatroom to join.
 * @param password Optionally, a password that may be required for somechannels.
 * @throws OperationFailedException failed to join the chat room
 */
public void join(final ChatRoomIrcImpl chatroom,final String password) throws OperationFailedException {
  if (!isConnected())   throw new IllegalStateException("String_Node_Str");
  if (chatroom == null)   throw new IllegalArgumentException("String_Node_Str");
  if (password == null)   throw new IllegalArgumentException("String_Node_Str");
  if (this.joined.containsKey(chatroom.getIdentifier()) || chatroom.isPrivate()) {
    return;
  }
  LOGGER.trace("String_Node_Str" + chatroom.getIdentifier());
  final Result<Object,Exception> joinSignal=new Result<Object,Exception>();
synchronized (joinSignal) {
    LOGGER.trace("String_Node_Str");
    this.irc.joinChannel(chatroom.getIdentifier(),password,new Callback<IRCChannel>(){
      @Override public void onSuccess(      IRCChannel channel){
        LOGGER.trace("String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
        ChatRoomIrcImpl actualChatRoom=chatroom;
synchronized (joinSignal) {
          try {
            if (!channel.getName().equalsIgnoreCase(actualChatRoom.getIdentifier())) {
              actualChatRoom=new ChatRoomIrcImpl(channel.getName(),IrcStack.this.provider);
              MessageIrcImpl message=new MessageIrcImpl("String_Node_Str" + channel.getName(),"String_Node_Str","String_Node_Str",null);
              IrcStack.this.provider.getMUC().registerChatRoomInstance(actualChatRoom);
              chatroom.fireMessageReceivedEvent(message,null,new Date(),MessageReceivedEvent.SYSTEM_MESSAGE_RECEIVED);
            }
            IrcStack.this.joined.put(actualChatRoom.getIdentifier(),actualChatRoom);
            IrcStack.this.irc.addListener(new ChatRoomListener(actualChatRoom));
            IRCTopic topic=channel.getTopic();
            actualChatRoom.updateSubject(topic.getValue());
            for (            IRCUser user : channel.getUsers()) {
              ChatRoomMemberRole role=ChatRoomMemberRole.SILENT_MEMBER;
              Set<IRCUserStatus> statuses=channel.getStatusesForUser(user);
              for (              IRCUserStatus status : statuses) {
                role=convertMemberMode(status.getChanModeType().charValue());
              }
              if (IrcStack.this.getNick().equals(user.getNick())) {
                actualChatRoom.prepUserRole(role);
              }
 else {
                ChatRoomMemberIrcImpl member=new ChatRoomMemberIrcImpl(IrcStack.this.provider,actualChatRoom,user.getNick(),role);
                actualChatRoom.addChatRoomMember(member.getContactAddress(),member);
              }
            }
          }
  finally {
            IrcStack.this.provider.getMUC().fireLocalUserPresenceEvent(actualChatRoom,LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_JOINED,null);
            LOGGER.trace("String_Node_Str" + "String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
            joinSignal.setDone();
            joinSignal.notifyAll();
          }
        }
      }
      @Override public void onFailure(      Exception e){
        LOGGER.trace("String_Node_Str" + "String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
synchronized (joinSignal) {
          try {
            MessageIrcImpl message=new MessageIrcImpl("String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str"+ e.getMessage()+ "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
            chatroom.fireMessageReceivedEvent(message,null,new Date(),MessageReceivedEvent.SYSTEM_MESSAGE_RECEIVED);
          }
  finally {
            LOGGER.trace("String_Node_Str" + "String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
            joinSignal.setDone(e);
            joinSignal.notifyAll();
          }
        }
      }
    }
);
    try {
      while (!joinSignal.isDone()) {
        LOGGER.trace("String_Node_Str");
        joinSignal.wait();
      }
      LOGGER.trace("String_Node_Str" + chatroom.getIdentifier() + "String_Node_Str");
      Exception e=joinSignal.getException();
      if (e != null) {
        throw new OperationFailedException(e.getMessage(),OperationFailedException.CHAT_ROOM_NOT_JOINED,e);
      }
    }
 catch (    InterruptedException e) {
      throw new OperationFailedException(e.getMessage(),OperationFailedException.INTERNAL_ERROR,e);
    }
  }
}