Fix MucEnterConfiguration.Builder.withPresence(Presence) throw ISE

when presence is of type available. This inverts the logic to fix
this.
This commit is contained in:
Florian Schmaus 2017-01-30 11:59:09 +01:00
parent 85fcb55bd9
commit 187fe37cd7
1 changed files with 4 additions and 3 deletions

View File

@ -95,15 +95,16 @@ public final class MucEnterConfiguration {
/** /**
* Set the presence used to join the MUC room. * Set the presence used to join the MUC room.
* <p> * <p>
* The 'to' value of the given presence will be overridden. * The 'to' value of the given presence will be overridden and the given presence must be of type
* 'available', otherwise an {@link IllegalArgumentException} will be thrown.
* <p> * <p>
* *
* @param presence * @param presence
* @return a reference to this builder. * @return a reference to this builder.
*/ */
public Builder withPresence(Presence presence) { public Builder withPresence(Presence presence) {
if (presence.getType() == Presence.Type.available) { if (presence.getType() != Presence.Type.available) {
throw new IllegalArgumentException(); throw new IllegalArgumentException("Presence must be of type 'available'");
} }
joinPresence = presence; joinPresence = presence;