I get an error when leaving the group in openfire 4.6.0

I get an error when leaving a group I’m a member of.
I sent presence and room.getRole () while calling room.send method as here, but it fell into a stackowerflow error and when I investigated the error I saw that the canBroadcastPresence method worked incorrectly. Here, when using ‘contains’ it returns ‘false’ even though both objects have the same type and the same value.
The LocalMUCRoom.canBroadcastPresence
method was as follows before 4.6.0.

public boolean canBroadcastPresence(String roleToBroadcast) {
    return "none".equals(roleToBroadcast) || rolesToBroadcastPresence.contains(roleToBroadcast);
}

Changed as follows after 4.6.0.

public boolean canBroadcastPresence(@Nonnull final MUCRole.Role roleToBroadcast) {
    return MUCRole.Role.none.equals(roleToBroadcast) || rolesToBroadcastPresence.contains(roleToBroadcast);
}

I don’t know the exact cause of this problem, but when I fixed it as follows, I found it worked fine.

public boolean canBroadcastPresence(@Nonnull final MUCRole.Role roleToBroadcast) {
    return MUCRole.Role.none.equals(roleToBroadcast) || rolesToBroadcastPresence.contains(roleToBroadcast.toString());
}

I use openfire rest-api to leave the group. I used the code in this PR in rest-api. I just discovered that the problem is caused by the room.send method. The code was giving an error, but the person was deleted from the group.

1 Like