diff --git a/src/java/org/jivesoftware/openfire/plugin/rest/controller/MUCRoomController.java b/src/java/org/jivesoftware/openfire/plugin/rest/controller/MUCRoomController.java index a80da08ba..41dc859cf 100644 --- a/src/java/org/jivesoftware/openfire/plugin/rest/controller/MUCRoomController.java +++ b/src/java/org/jivesoftware/openfire/plugin/rest/controller/MUCRoomController.java @@ -513,11 +513,13 @@ public MUCRoomEntity convertToMUCRoomEntity(MUCRoom room, boolean expand) { private void setRoles(MUCRoom room, MUCRoomEntity mucRoomEntity) throws ForbiddenException, NotAllowedException, ConflictException { List roles = new ArrayList(); - Collection owners = new ArrayList(); Collection existingOwners = new ArrayList(); + List mucRoomEntityOwners = new ArrayList(); - List mucRoomEntityOwners = MUCRoomUtils.convertStringsToJIDs(mucRoomEntity.getOwners()); - owners.addAll(room.getOwners()); + for (String ownerJid : mucRoomEntity.getOwners()) { + mucRoomEntityOwners.add(UserUtils.checkAndGetJID(ownerJid)); + } + Collection owners = new ArrayList(room.getOwners()); // Find same owners for (JID jid : owners) { @@ -528,7 +530,6 @@ private void setRoles(MUCRoom room, MUCRoomEntity mucRoomEntity) throws Forbidde // Don't delete the same owners owners.removeAll(existingOwners); - room.addOwners(MUCRoomUtils.convertStringsToJIDs(mucRoomEntity.getOwners()), room.getRole()); // Collect all roles to reset roles.addAll(owners); @@ -540,18 +541,22 @@ private void setRoles(MUCRoom room, MUCRoomEntity mucRoomEntity) throws Forbidde room.addNone(jid, room.getRole()); } - room.addOwners(MUCRoomUtils.convertStringsToJIDs(mucRoomEntity.getOwners()), room.getRole()); + for (String ownerJid : mucRoomEntity.getOwners()) { + room.addOwner(UserUtils.checkAndGetJID(ownerJid), room.getRole()); + } if (mucRoomEntity.getAdmins() != null) { - room.addAdmins(MUCRoomUtils.convertStringsToJIDs(mucRoomEntity.getAdmins()), room.getRole()); + for (String adminJid : mucRoomEntity.getAdmins()) { + room.addAdmin(UserUtils.checkAndGetJID(adminJid), room.getRole()); + } } if (mucRoomEntity.getMembers() != null) { for (String memberJid : mucRoomEntity.getMembers()) { - room.addMember(new JID(memberJid), null, room.getRole()); + room.addMember(UserUtils.checkAndGetJID(memberJid), null, room.getRole()); } } if (mucRoomEntity.getOutcasts() != null) { for (String outcastJid : mucRoomEntity.getOutcasts()) { - room.addOutcast(new JID(outcastJid), null, room.getRole()); + room.addOutcast(UserUtils.checkAndGetJID(outcastJid), null, room.getRole()); } } }