I’ve updated to the latest SVN version. I wrote the following minimal program:
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smackx.pubsub.PubSubManager;
import org.jivesoftware.smackx.pubsub.LeafNode;
import org.jivesoftware.smackx.pubsub.Subscription;
import org.jivesoftware.smackx.pubsub.Item;
import java.util.List; public class ShowXmppQueue { public static void main(String[] args) { try { if (args.length != 3 && args.length != 4) { System.err.println("Usage: java ShowXmppQueue user password host [xmpp-domain]");
System.exit(-1);
} String domain = args[args.length - 1]; XMPPConnection con = new XMPPConnection(args[2]);
con.connect();
con.login(args[0], args[1], "ShowXmppQueue");
PubSubManager mgr = new PubSubManager(con, "pubsub."+domain);
for (Subscription sub : mgr.getSubscriptions()) { LeafNode node = (LeafNode)mgr.getNode(sub.getNode());
System.out.println("Node:" + node.getId()); for (Item item : node.getItems()) {
System.out.println("Stored item: " + item);
} /*
List items = node.getItems(); for (Object item : items) { if (item instanceof Item) { System.out.println("Stored item: " + ((Item)item).toXML());
} else { System.out.println("Unknown packet type: " + item);
}
}
*/
}
} catch (Exception ex) { ex.printStackTrace();
}
}
}
This gives me the following output:
Node:ruote_development/workitems/user/alice/updates
Stored item: org.jivesoftware.smackx.pubsub.PayloadItem | Content [<item id='7d7ee3d0-e300-012c-4a75-000c2916d068'><value>{"description":"Selecci\u00f3n operador","wi_uri":"/workitems/20100114-dudegukumu/0_1_0","proc_uri":"/processes/20100114-dudegukumu","params":{"form-id":"crm_busqueda","assigned-to":"initiator","form-ver":"latest","immediate":true,"description":"Selecci\u00f3n operador","ref":"bmForm"}}</value></item>]
java.lang.ClassCastException: org.jivesoftware.smack.packet.DefaultPacketExtension cannot be cast to org.jivesoftware.smackx.pubsub.Item
at ShowXmppQueue.main(ShowXmppQueue.java:29)
Which is patently wrong since LeafNode#getItems() is declared as public List getItems()
If I comment out the for loop and uncomment the other for loop, I get the following:
Node:ruote_development/workitems/user/alice/updates
Stored item: <item id='7d7ee3d0-e300-012c-4a75-000c2916d068'><value>{"description":"Selecci\u00f3n operador","wi_uri":"/workitems/20100114-dudegukumu/0_1_0","proc_uri":"/processes/20100114-dudegukumu","params":{"form-id":"crm_busqueda","assigned-to":"initiator","form-ver":"latest","immediate":true,"description":"Selecci\u00f3n operador","ref":"bmForm"}}</value></item>
Unknown packet type: org.jivesoftware.smack.packet.DefaultPacketExtension@56f449b8
Stored item: <item id='c832d780-e32e-012c-4a77-000c2916d068'><value>{"description":"Selecci\u00f3n operador","wi_uri":"/workitems/20100114-hikazakida/0_1_0","proc_uri":"/processes/20100114-hikazakida","params":{"form-id":"crm_busqueda","assigned-to":"initiator","form-ver":"latest","immediate":true,"description":"Selecci\u00f3n operador","ref":"bmForm"}}</value></item>
Unknown packet type: org.jivesoftware.smack.packet.DefaultPacketExtension@599855ed
Stored item: <item id='b221c120-e3c9-012c-4a79-000c2916d068'><value>{"description":"Selecci\u00f3n operador","wi_uri":"/workitems/20100115-duderikode/0_1_0","proc_uri":"/processes/20100115-duderikode","params":{"form-id":"crm_busqueda","assigned-to":"initiator","form-ver":"latest","immediate":true,"description":"Selecci\u00f3n operador","ref":"bmForm"}}</value></item>
Unknown packet type: org.jivesoftware.smack.packet.DefaultPacketExtension@bc794cc
Stored item: <item id='020c7cc0-e55c-012c-4a7b-000c2916d068'><value>{"description":"Selecci\u00f3n operador","wi_uri":"/workitems/20100117-dudememuza/0_1_0","proc_uri":"/processes/20100117-dudememuza","params":{"form-id":"crm_busqueda","assigned-to":"initiator","form-ver":"latest","immediate":true,"description":"Selecci\u00f3n operador","ref":"bmForm"}}</value></item>
Unknown packet type: org.jivesoftware.smack.packet.DefaultPacketExtension@72adf5be
Stored item: <item id='82086a70-e65a-012c-4a83-000c2916d068'><value>{"description":"Selecci\u00f3n operador","wi_uri":"/workitems/20100118-hopujekujo/0_1_0","proc_uri":"/processes/20100118-hopujekujo","params":{"form-id":"crm_busqueda","assigned-to":"initiator","form-ver":"latest","immediate":true,"description":"Selecci\u00f3n operador","ref":"bmForm"}}</value></item>
Unknown packet type: org.jivesoftware.smack.packet.DefaultPacketExtension@3b5b123b
Stored item: <item id='43f00a10-e66f-012c-4a85-000c2916d068'><value>{"description":"Selecci\u00f3n operador","wi_uri":"/workitems/20100118-jijuhatsuru/0_1_0","proc_uri":"/processes/20100118-jijuhatsuru","params":{"form-id":"crm_busqueda","assigned-to":"initiator","form-ver":"latest","immediate":true,"description":"Selecci\u00f3n operador","ref":"bmForm"}}</value></item>
Again, we see that every other packet is parsed wrong, giving a DefaultPacketExtension instead of an Item. Checking this with a different client (in Ruby) I get the correct output:
persisted USR item: c33646b0-e66a-012c-4a84-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100118-jenitoyota/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100118-jenitoyota&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: 82086a70-e65a-012c-4a83-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100118-hopujekujo/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100118-hopujekujo&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: 43f00a10-e66f-012c-4a85-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100118-jijuhatsuru/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100118-jijuhatsuru&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: 2ca850a0-e625-012c-4a7c-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100118-dudemodime/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100118-dudemodime&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: 020c7cc0-e55c-012c-4a7b-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100117-dudememuza/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100117-dudememuza&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: dd386e50-e492-012c-4a7a-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100116-duderukuchi/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100116-duderukuchi&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: 3f15f8f0-e340-012c-4a78-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100114-jamunojisa/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100114-jamunojisa&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: 1b45d7f0-e329-012c-4a76-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100114-hejutapura/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100114-hejutapura&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: c832d780-e32e-012c-4a77-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100114-hikazakida/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100114-hikazakida&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: b221c120-e3c9-012c-4a79-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100115-duderikode/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100115-duderikode&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----
persisted USR item: 7d7ee3d0-e300-012c-4a75-000c2916d068<value>{&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;wi_uri&quot;:&quot;/workitems/20100114-dudegukumu/0_1_0&quot;,&quot;proc_uri&quot;:&quot;/processes/20100114-dudegukumu&quot;,&quot;params&quot;:{&quot;form-id&quot;:&quot;crm_busqueda&quot;,&quot;assigned-to&quot;:&quot;initiator&quot;,&quot;form-ver&quot;:&quot;latest&quot;,&quot;immediate&quot;:true,&quot;description&quot;:&quot;Selecci\u00f3n operador&quot;,&quot;ref&quot;:&quot;bmForm&quot;}}</value>
----