Smack should not expect pubsub options to contain a data form

The interaction below shows Smack sending off a request for ‘options’ on a pubsub node. The server sends back an error (if that’s actually the correct thing to do for the server is inconsequential), that echos the original query back.

Here, Smack seems to choke on the fact that the ‘options’ child element does not contain a child element / data form.

If only for error handling, it seems wrong for Smacks parser to require a child element there.

14:41:02 SENT (2): 
<iq to='pubsub.example.org' id='H44B4-120' type='get'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <options node='sinttest-multisubscribe-nodename-lu7se' jid='smack-inttest-two-lu7se@example.org'/>
  </pubsub>
</iq>


14:41:02 RECV (2): 
<iq type="error" id="H44B4-120" from="pubsub.example.org" to="smack-inttest-two-lu7se@example.org/two-lu7se">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <options node="sinttest-multisubscribe-nodename-lu7se" jid="smack-inttest-two-lu7se@example.org"/>
  </pubsub>
  <error code="400" type="modify">
    <bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
    <subid-required xmlns="http://jabber.org/protocol/pubsub#errors"/>
  </error>
</iq>

14:41:02 XMPPConnection closed due to an exception (XMPPTCPConnection[smack-inttest-two-lu7se@example.org/two-lu7se] (2))
java.util.NoSuchElementException
	at java.util.ArrayList$Itr.next(ArrayList.java:864)
	at org.jivesoftware.smackx.pubsub.provider.FormNodeProvider.createReturnExtension(FormNodeProvider.java:43)
	at org.jivesoftware.smackx.pubsub.provider.FormNodeProvider.createReturnExtension(FormNodeProvider.java:35)
	at org.jivesoftware.smack.provider.EmbeddedExtensionProvider.parse(EmbeddedExtensionProvider.java:108)
	at org.jivesoftware.smack.provider.EmbeddedExtensionProvider.parse(EmbeddedExtensionProvider.java:85)
	at org.jivesoftware.smack.provider.Provider.parse(Provider.java:53)
	at org.jivesoftware.smack.util.PacketParserUtils.parseExtensionElement(PacketParserUtils.java:836)
	at org.jivesoftware.smack.util.PacketParserUtils.addExtensionElement(PacketParserUtils.java:924)
	at org.jivesoftware.smack.util.PacketParserUtils.addExtensionElement(PacketParserUtils.java:919)
	at org.jivesoftware.smackx.pubsub.provider.PubSubProvider.parse(PubSubProvider.java:49)
	at org.jivesoftware.smackx.pubsub.provider.PubSubProvider.parse(PubSubProvider.java:38)
	at org.jivesoftware.smack.provider.IQProvider.parse(IQProvider.java:64)
	at org.jivesoftware.smack.provider.IqProvider.parse(IqProvider.java:40)
	at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:551)
	at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:113)
	at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1450)
	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)
	at java.lang.Thread.run(Thread.java:748)

(note that I’ve applied the fix provided in https://github.com/igniterealtime/Smack/pull/439 to generate this request. Without this fix, the same scenario unfolds: an error is returned by the server that is not parsed by Smack’s parser)

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