A room owner or admin is able to setup invalid room affiliations. At least with the room configuration it is possible to apply invalid JIDs for administrators or owners affiliations.
The attached patch change the functions to add room affiliations only with an JID object instead of a String. The former methods will be marked as deprecated. The InvalidArgumentException for invalid JIDs is catched in the MUCUser object where the requests are processed.