PubSubManager.getLeafNode() throws PubSubAssertionError.DiscoInfoNodeAssertionError if node exists but its not a PubSub Node

Description

I turns out there case when discovering pubsub nodes (XEP-0060 5.3) where the node exists, but is not a pubsub node. So the service will not return an <item-not-found/> error, but an result IQ without an <identity category='pubsub'/>. Smack's code does not currently account for that. This case is very unlikely, if not impossible on plain traditional PubSub services, but apparently not uncommon when PEP is used.

Forces users to catch the PubSubAssertionError when querying PubSubNodes.

For example, ejabberd will return a result IQ without <identity category='pubsub'/>:

17:28:02 SENT (0): <iq to='myclient@ejabberd.srv' id='cq41A-75' type='get'><query xmlns='http://jabber.org/protocol/disco#info' node='invalid-node'></query></iq>
17:28:03 RECV (0): <iq from='myclient@ejabberd.srv' to='myclient@ejabberd.srv/17165994385926269896640' id='cq41A-75' type='result'><query xmlns='http://jabber.org/protocol/disco#info' node='invalid-node'><identity category='account' type='registered'/></query></iq>

Exception in thread "main" org.jivesoftware.smackx.pubsub.PubSubAssertionError$DiscoInfoNodeAssertionError: PubSub service 'myclient@ejabberd.srv' returned disco info result for node 'blabla', but it did not contain an Identity of type 'leaf' or 'collection' (and category 'pubsub'), which is not allowed according to XEP-60 5.3.
    at org.jivesoftware.smackx.pubsub.PubSubManager.getNode(PubSubManager.java:253)
    at org.jivesoftware.smackx.pubsub.PubSubManager.getLeafNode(PubSubManager.java:320)

 

The confusing which lead the Smack developer to  assume that a result response must always contain an identity came from  XEP-0060 § 5.3 which states "The "disco#info" result MUST include an identity with a category of "pubsub" and a type of either "leaf" or "collection"." and here we see an IQ result without an identity. Furthermore XEP-0030 § 7 states that item-not-found jid+nodeId does not exists.

Environment

None

Activity

Florian Schmaus 
August 1, 2017 at 10:29 PM

Not a bug in Smack, this is ejabberd misbehaving.

vanitasvitae 
May 7, 2017 at 11:17 PM

Has been verified with ejabberd server draugr.de

vanitasvitae 
May 7, 2017 at 10:08 PM

Fixed

Details

Assignee

Reporter

Labels

Expected Effort

Components

Fix versions

Affects versions

Priority

Created May 5, 2017 at 6:04 PM
Updated August 14, 2017 at 6:15 PM
Resolved August 14, 2017 at 6:15 PM