When I had already entered the multi-user chat in this instance from Android application and it began to load the list of users with presence, a rather strange problem arose with parsing replies and at that moment the connection was interrupted.
I have no idea what is special about Smack’s MUC feature (or maybe custom QIP client presence), since this instance caused an parsing error.
I don’t think we see the exception that was thrown during parsing in the screenshot. I think the NotConnectedException is probably a consequence the previous parsing exception.
Only the parsing exception will tell us what caused it.
I think the NotConnectedException is probably a consequence the previous parsing exception
The only catch is that Smack displays this exception in the logs, which led to the disconnection.
mucm = MultiUserChatManager.getInstanceFor(
xmppClient.getConnection()
); // <-- ok
muc = mucm.getMultiUserChat(JidCreate.entityBareFrom((String) id)); // <-- ok
muc.join(Resourcepart.from(nickname)); //<-- disconnected due to parsing error and throwing NotConnectedException
// origin of exception, no specifics
Caused by: java.lang.NumberFormatException: Value out of range. Value:"128" Radix:10
at java.lang.Byte.parseByte(Byte.java:153)
at java.lang.Byte.valueOf(Byte.java:207)
at java.lang.Byte.valueOf(Byte.java:233)
at org.jivesoftware.smack.util.ParserUtils.getByteAttributeFromNextText(ParserUtils.java:197)
at org.jivesoftware.smack.util.PacketParserUtils.parsePresence(PacketParserUtils.java:453)
at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:115)
at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1448)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1000(XMPPTCPConnection.java:130)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:969)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:913)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:936)
For detailed debugging, it may be necessary to monitor stanzas entering the client input.
Not sure if I understand, but the original exception should either be logged and/or thrown. I am pretty sure it is made available to the “user”. If not, then this is something that should be fixed in Smack. How did you obtain the exception below?
I am pretty sure that this is caused by a presence stanza with an invalid priority value (128).
It appears that someone is sending an invalid presence stanza to a chatroom, and the server on conference.jabber.ru is not rejecting this, but instead broadcasts it.
The problem here isn’t Smack. It is strict in what it accepts, but the data that it gets to parse is obviously invalid. There’s a valid argument to be made for Smack to simply drop data that is invalid, and that’s the design choice that was made here.