mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
Do not silently swallow exceptions in ChatStateManager
This commit is contained in:
parent
19a445ea02
commit
0e15a903d9
1 changed files with 7 additions and 1 deletions
|
@ -23,6 +23,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.Manager;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
|
@ -62,6 +64,8 @@ import org.jxmpp.jid.EntityFullJid;
|
|||
*/
|
||||
public final class ChatStateManager extends Manager {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(ChatStateManager.class.getName());
|
||||
|
||||
public static final String NAMESPACE = "http://jabber.org/protocol/chatstates";
|
||||
|
||||
private static final Map<XMPPConnection, ChatStateManager> INSTANCES = new WeakHashMap<>();
|
||||
|
@ -135,12 +139,14 @@ public final class ChatStateManager extends Manager {
|
|||
|
||||
Chat chat = ChatManager.getInstanceFor(connection()).chatWith(bareFrom);
|
||||
ExtensionElement extension = message.getExtension(NAMESPACE);
|
||||
String chatStateElementName = extension.getElementName();
|
||||
|
||||
ChatState state;
|
||||
try {
|
||||
state = ChatState.valueOf(extension.getElementName());
|
||||
state = ChatState.valueOf(chatStateElementName);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
LOGGER.log(Level.WARNING, "Invalid chat state element name: " + chatStateElementName, ex);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue