powered by Jive Software

Asmack: LeafNode.getItems() returns weird results

Hi everyone,

I am using asmack as the xmpp backend for an Android app.

I have recently updated the asmack version from 16-0.8.2 to 17-0.8.3, and since them my app crashes because of LeafNode.getItems() returns a collection in which every other element is not an extension of Item, but rather a DefaultPacketExtension, so I’m getting this error:

java.lang.ClassCastException: org.jivesoftware.smack.packet.DefaultPacketExtension cannot be cast to org.jivesoftware.smackx.pubsub.Item

I have searched for this error, and I found this 3-year old thread about it: http://community.igniterealtime.org/thread/40781

It is the exact same symptom, but as you can see there, it has been fixed back then. It seems the latest update brought a regression with this.

(I apologize in advance, I don’t know the smack version difference between the asmack versions. I have tried looking for this information, but couldn’t find anything. If someone can point me in the direction of where I can search the code for hints, that’ll be great!)

Thanks,

Josh

It could be a regression. In fact the code of ItemProvider from trunk and the 3.X branch differs. The later one contains more changes (fixes) and is used by asmack. I don’t know if any of the delta changes could cause this. Since Robin is the author of the pubsub extension and was also involved in SMACK-288 I think he could shed some light into this.

Unfortunately, I reintroduced this bug when applying a patch for a different problem related to improper usage of the pull parser.

I think the patch was written against the older version of the code that still had the bug.

Logged as SMACK-455.

The latest aSmack version does include the fix for SMACK-455. Please test and report back.