Problem description (bug report):
When setting a new node using pubsub (this node has never been set before), the server sends back an incorrect (doesn’t completely follow the xep-0060 standard). For example: I get this as a response:
however, xep-0060 says we must get
– from xep-0060
<xs:element name='items'>
<xs:complexType>
<xs:choice>
<xs:element ref='item' minOccurs='0' maxOccurs='unbounded'/>
<xs:element ref='retract' minOccurs='0' maxOccurs='unbounded'/>
</xs:choice>
<xs:attribute name='node' type='xs:string' use='required'/>
</xs:complexType>
</xs:element>
So, items needs to have node="scene" in my example.
an example of what it should look like is in 7.1.2.2 Notification Without Payload
When creating a new node, set a breakpoint in
In CollectionNode.java, we could add the required attrib to items with a few lines of code.
Here is a quick fix, replace this method with this new code:
void childNodeAdded(Node child) {
// Build packet to broadcast to subscribers
Message message = new Message();
Element event = message.addChildElement(“event”, “http://jabber.org/protocol/pubsub#event”);
Element items = event.addElement(“items”).addAttribute(“node”,child.getNodeID());
Element item = items.addElement(“item”);
item.addAttribute(“id”, child.getNodeID());
if (deliverPayloads) {
item.add(child.getMetadataForm().getElement());
}
// Broadcast event notification to subscribers
broadcastCollectionNodeEvent(child, message);
}
The only reason this bug is really bad is because Smack’s use of the XmppPullParser fails on the validation of this packet, therefore shutting down my connection. Otherwise, I could simply ignore this response.
Any other suggestions or comments? Is my bug valid?
Marcus