Program: 104172
Project: 104172
Buggy source:
/** 
 * Returns a reference to a chatRoom named <tt>roomName</tt> or null if that room does not exist.
 * @param roomName the name of the <tt>ChatRoom</tt> that we're lookingfor.
 * @return the <tt>ChatRoom</tt> named <tt>roomName</tt> if it exists, nullotherwise.
 * @throws OperationFailedException if an error occurs while trying todiscover the room on the server.
 * @throws OperationNotSupportedException if the server does not supportmulti user chat
 */
public ChatRoom findRoom(String roomName) throws OperationFailedException, OperationNotSupportedException {
  assertSupportedAndConnected();
  String canonicalRoomName=getCanonicalRoomName(roomName);
  ChatRoom room=chatRoomCache.get(canonicalRoomName);
  if (room == null) {
    try {
      Collection<HostedRoom> co=MultiUserChat.getHostedRooms(getXmppConnection(),canonicalRoomName);
      for (      HostedRoom ho : co) {
        if (ho.getJid().equals(canonicalRoomName)) {
          MultiUserChat muc=new MultiUserChat(getXmppConnection(),canonicalRoomName);
          room=new ChatRoomJabberImpl(muc,jabberProvider);
          chatRoomCache.put(canonicalRoomName,room);
          break;
        }
      }
    }
 catch (    XMPPException ex) {
      if (!ex.getXMPPError().getCondition().equals(XMPPError.Condition.item_not_found.toString())) {
        MultiUserChat muc=new MultiUserChat(getXmppConnection(),canonicalRoomName);
        room=new ChatRoomJabberImpl(muc,jabberProvider);
        chatRoomCache.put(canonicalRoomName,room);
      }
      logger.debug("String_Node_Str" + canonicalRoomName + "String_Node_Str",ex);
    }
  }
  return room;
}

Fixed version (ground truth):
/** 
 * Returns a reference to a chatRoom named <tt>roomName</tt> or null if that room does not exist.
 * @param roomName the name of the <tt>ChatRoom</tt> that we're lookingfor.
 * @return the <tt>ChatRoom</tt> named <tt>roomName</tt> if it exists, nullotherwise.
 * @throws OperationFailedException if an error occurs while trying todiscover the room on the server.
 * @throws OperationNotSupportedException if the server does not supportmulti user chat
 */
public ChatRoom findRoom(String roomName) throws OperationFailedException, OperationNotSupportedException {
  assertSupportedAndConnected();
  String canonicalRoomName=getCanonicalRoomName(roomName);
  ChatRoom room=chatRoomCache.get(canonicalRoomName);
  if (room != null)   return room;
  try {
    RoomInfo infos=MultiUserChat.getRoomInfo(getXmppConnection(),canonicalRoomName);
    if (infos.getRoom().equals(canonicalRoomName)) {
      MultiUserChat muc=new MultiUserChat(getXmppConnection(),canonicalRoomName);
      room=new ChatRoomJabberImpl(muc,jabberProvider);
      chatRoomCache.put(canonicalRoomName,room);
      return room;
    }
  }
 catch (  XMPPException xe) {
    return null;
  }
catch (  NullPointerException ne) {
  }
  try {
    Collection<HostedRoom> co=MultiUserChat.getHostedRooms(getXmppConnection(),canonicalRoomName);
  }
 catch (  XMPPException xe) {
    if (xe.getXMPPError().getCondition().equals(XMPPError.Condition.item_not_found.toString())) {
      return null;
    }
 else {
      MultiUserChat muc=new MultiUserChat(getXmppConnection(),canonicalRoomName);
      room=new ChatRoomJabberImpl(muc,jabberProvider);
      chatRoomCache.put(canonicalRoomName,room);
      return room;
    }
  }
  return null;
}