public List<Presence> addOwner(@Nonnull final JID targetUserAddress, @Nonnull final Affiliation actorAffiliation) throws ForbiddenException
    {
        if (Affiliation.owner != actorAffiliation) {
            throw new ForbiddenException();
        }

        final JID targetUserAddressBare = targetUserAddress.asBareJID();

        synchronized (this) {
            // Check if user is already an owner (explicitly)
            if (owners.contains(targetUserAddressBare)) {
                // Do nothing
                return Collections.emptyList();
            }

            // Remove the user from other affiliation lists
            final Affiliation oldAffiliation = getAffiliation(targetUserAddressBare);
            switch (oldAffiliation) {
                case admin:
                    removeAdmin(targetUserAddressBare, actorAffiliation);
                    break;
                case member:
                    removeMember(targetUserAddressBare, actorAffiliation, null); // No need to calculate actor role, as the 'owner' affiliation is guaranteed to be allowed to perform this action.
                    break;
                case outcast:
                    removeOutcast(targetUserAddressBare, actorAffiliation, null); // No need to calculate actor role, as the 'owner' affiliation is guaranteed to be allowed to perform this action.
                    break;
            }
            owners.add(targetUserAddressBare);

            // Update the DB if the room is persistent
            MUCPersistenceManager.saveAffiliationToDB(
                this,
                targetUserAddressBare,
                null,
                Affiliation.owner,
                oldAffiliation);
        }
        // apply the affiliation change, assigning a new affiliation based on the group(s) of the affected user(s)
        return applyAffiliationChange(targetUserAddressBare, null, null, null);
    }
Adds a new user to the list of owners.

@param targetUserAddress the (real) JID of the user to add as owner.
@param actorAffiliation the room affiliation of the user that is trying to modify the owners list.
@return the list of updated presences of all the client resources that the client used to
        join the room.
@throws ForbiddenException If the user is not allowed to modify the owner list.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java