Hi,
in some cases, when attempting to send a message, I get the following exception:
org.jivesoftware.smack.SmackException$SmackWrappedException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.jivesoftware.smack.packet.XmlEnvironment.getEffectiveNamespace()' on a null object reference
at org.jivesoftware.smack.AbstractXMPPConnection.setCurrentConnectionExceptionAndNotify(AbstractXMPPConnection.java:687)
at org.jivesoftware.smack.AbstractXMPPConnection.notifyConnectionError(AbstractXMPPConnection.java:991)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$5400(XMPPTCPConnection.java:131)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.writePackets(XMPPTCPConnection.java:1419)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.access$4200(XMPPTCPConnection.java:1172)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1.run(XMPPTCPConnection.java:1222)
at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.jivesoftware.smack.packet.XmlEnvironment.getEffectiveNamespace()' on a null object reference
at org.jivesoftware.smack.util.XmlStringBuilder.appendXmlTo(XmlStringBuilder.java:711)
at org.jivesoftware.smack.util.XmlStringBuilder.write(XmlStringBuilder.java:673)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.writePackets(XMPPTCPConnection.java:1356)
What might be the reason? I can’t consistently reproduce it, it only occurs to some users randomly.
I’ve implemented a reconnetting mechanism, so after a few seconds everything works fine, but I’d like to avoid leaving the message “pending” for some time.
Smack version: 4.4.5