powered by Jive Software

Smack 4.4.0-alpha3 (20200404): Fail to parse CapsExtension from the received presence stanza

While doing aTalk system testing, caught the following exception causes by smack failed to phrase CapsExtension from the <presence/> stanza.

The received <presence/> stanza seems to have properly formatted. No sure why smack throws exception

04-14 11:13:29.094 31145-3445/org.atalk.android D/SMACK: RECV (1): 
    <presence xml:lang='en-GB' to='leopard@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net/atalk' id='6QCAU-67'>
      <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='https://android.atalk.org' ver='fku8pb1iKZfU8G0glOVZ6qsCLfk='/>
      <x xmlns='vcard-temp:x:update'/>
      <priority>
        30
      </priority>
      <status/>
    </presence>
04-14 11:13:29.104 31145-3445/org.atalk.android W/aTalk: [185] org.jivesoftware.smack.util.PacketParserUtils.parsePresence() Failed to parse extension element in Presence stanza: PresenceBuilder(id='6QCAU-67' from='peacock@atalk.sytes.net/atalk' to='leopard@atalk.sytes.net/atalk' language='en-GB' type='available' Extension Elements[{http://jabber.org/protocol/caps}c])
    java.lang.NullPointerException: Attempt to invoke interface method 'javax.xml.namespace.QName org.jivesoftware.smack.packet.ExtensionElement.getQName()' on a null object reference
        at org.jivesoftware.smack.packet.StanzaBuilder.addExtension(StanzaBuilder.java:160)
        at org.jivesoftware.smack.util.PacketParserUtils.parsePresence(PacketParserUtils.java:487)
        at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:122)
        at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1417)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$600(XMPPTCPConnection.java:136)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:947)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:893)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:913)
        at java.lang.Thread.run(Thread.java:818)

After further investigation, found that it is not the CapsExtension that is the cause of the problem.
But the next EE i.e.

<x xmlns=‘vcard-temp:x:update’/>

Currently aTalk returns null when there is no <photo/> element found i.e.

      <x xmlns='vcard-temp:x:update'>
        <photo>
          b5cbe9c2dec73d9556ced8261c64667f744493db
        </photo>
      </x>

Changing aTalk returned value to

<x xmlns=‘vcard-temp:x:update’>

resolved the problem.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.