Program: 102951
Project: 102951
Buggy source:
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to.
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated.
 * @throws OperationFailedException if the room couldn't be created forsome reason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return ChatRoom the chat room that we've just created.
 */
public ChatRoom createChatRoom(String roomName,Map<String,Object> roomProperties) throws OperationFailedException, OperationNotSupportedException {
  assertSupportedAndConnected();
  ChatRoom room=null;
  if (roomName == null)   roomName="String_Node_Str" + StringUtils.randomString(4);
 else   room=findRoom(roomName);
  if (room == null) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    if (getXmppConnection().getHost().toLowerCase().contains("String_Node_Str")) {
      roomName="String_Node_Str" + UUID.randomUUID().toString() + "String_Node_Str";
    }
    MultiUserChat muc=null;
    try {
      muc=new MultiUserChat(getXmppConnection(),getCanonicalRoomName(roomName));
      muc.create(StringUtils.parseName(getXmppConnection().getUser()));
    }
 catch (    XMPPException ex) {
      logger.error("String_Node_Str",ex);
      throw new OperationFailedException("String_Node_Str",ex.getXMPPError().getCode(),ex.getCause());
    }
    boolean isPrivate=false;
    if (roomProperties != null) {
      Object isPrivateObject=roomProperties.get("String_Node_Str");
      if (isPrivateObject != null) {
        isPrivate=isPrivateObject.equals(true);
      }
    }
    try {
      Form form;
      if (isPrivate) {
        Form initForm=muc.getConfigurationForm();
        form=initForm.createAnswerForm();
        Iterator<FormField> fieldIterator=initForm.getFields();
        while (fieldIterator.hasNext()) {
          FormField initField=fieldIterator.next();
          if (initField == null || initField.getVariable() == null || initField.getType() == FormField.TYPE_FIXED || initField.getType() == FormField.TYPE_HIDDEN)           continue;
          FormField submitField=form.getField(initField.getVariable());
          if (submitField == null)           continue;
          Iterator<String> value=initField.getValues();
          while (value.hasNext())           submitField.addValue(value.next());
        }
        String[] fields={"String_Node_Str","String_Node_Str","String_Node_Str"};
        Boolean[] values={true,true,false};
        for (int i=0; i < fields.length; i++) {
          FormField field=new FormField(fields[i]);
          field.setType("String_Node_Str");
          form.addField(field);
          form.setAnswer(fields[i],values[i]);
        }
      }
 else {
        form=new Form(Form.TYPE_SUBMIT);
      }
      muc.sendConfigurationForm(form);
    }
 catch (    XMPPException e) {
      logger.error("String_Node_Str",e);
    }
    room=createLocalChatRoomInstance(muc);
    room.setLocalUserRole(ChatRoomMemberRole.OWNER);
  }
  return room;
}

Fixed version (ground truth):
/** 
 * Creates a room with the named <tt>roomName</tt> and according to the specified <tt>roomProperties</tt> on the server that this protocol provider is currently connected to.
 * @param roomName the name of the <tt>ChatRoom</tt> to create.
 * @param roomProperties properties specifying how the room should becreated.
 * @throws OperationFailedException if the room couldn't be created forsome reason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
 * @throws OperationNotSupportedException if chat room creation is notsupported by this server
 * @return ChatRoom the chat room that we've just created.
 */
public ChatRoom createChatRoom(String roomName,Map<String,Object> roomProperties) throws OperationFailedException, OperationNotSupportedException {
  assertSupportedAndConnected();
  ChatRoom room=null;
  if (roomName == null)   roomName="String_Node_Str" + StringUtils.randomString(4);
 else   room=findRoom(roomName);
  if (room == null) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str");
    if (getXmppConnection().getHost().toLowerCase().contains("String_Node_Str")) {
      roomName="String_Node_Str" + UUID.randomUUID().toString() + "String_Node_Str";
    }
    MultiUserChat muc=null;
    try {
      muc=new MultiUserChat(getXmppConnection(),getCanonicalRoomName(roomName));
      muc.create(JabberActivator.getGlobalDisplayDetailsService().getDisplayName(jabberProvider));
    }
 catch (    XMPPException ex) {
      logger.error("String_Node_Str",ex);
      throw new OperationFailedException("String_Node_Str",ex.getXMPPError().getCode(),ex.getCause());
    }
    boolean isPrivate=false;
    if (roomProperties != null) {
      Object isPrivateObject=roomProperties.get("String_Node_Str");
      if (isPrivateObject != null) {
        isPrivate=isPrivateObject.equals(true);
      }
    }
    try {
      Form form;
      if (isPrivate) {
        Form initForm=muc.getConfigurationForm();
        form=initForm.createAnswerForm();
        Iterator<FormField> fieldIterator=initForm.getFields();
        while (fieldIterator.hasNext()) {
          FormField initField=fieldIterator.next();
          if (initField == null || initField.getVariable() == null || initField.getType() == FormField.TYPE_FIXED || initField.getType() == FormField.TYPE_HIDDEN)           continue;
          FormField submitField=form.getField(initField.getVariable());
          if (submitField == null)           continue;
          Iterator<String> value=initField.getValues();
          while (value.hasNext())           submitField.addValue(value.next());
        }
        String[] fields={"String_Node_Str","String_Node_Str","String_Node_Str"};
        Boolean[] values={true,true,false};
        for (int i=0; i < fields.length; i++) {
          FormField field=new FormField(fields[i]);
          field.setType("String_Node_Str");
          form.addField(field);
          form.setAnswer(fields[i],values[i]);
        }
      }
 else {
        form=new Form(Form.TYPE_SUBMIT);
      }
      muc.sendConfigurationForm(form);
    }
 catch (    XMPPException e) {
      logger.error("String_Node_Str",e);
    }
    room=createLocalChatRoomInstance(muc);
    room.setLocalUserRole(ChatRoomMemberRole.OWNER);
  }
  return room;
}