LeafNode.getItems() deletes items from node

I’m using asmack-android-15-0.8.5.jar, and when I do leafnode.getItems(), it seems to delete all the items retrieved from the node. This isn’t documented behavior anywhere, is there anyway to stop it?

I’m also using Openfire 3.3.0, if it happens to be a problem on the server side.

Thank you,

-Paul

I don’t think that this should happen. You could attach the source of asmack and step through the getItems() method with a debugger. Additinally you chould enable Smack.DEBUG, which will print the incoming and outgoing stanzas and see if it a) behaves as specified by the XEP and b) there is some stanzas that may cause the deletion of the items. This should get you some insight on what’s going on.

I don’t see anything that would be causing the deletion in the debug log.

It seems to be a result of publishing messages to a node, then immediately calling getItems on that same node. The previous items will be cleared and only the most recently created ones will remain.

That is indeed odd behaviour, certainly not something I have ever seen from the Smack side. I am guessing that this is probably a server side error, but I don’t think I have ever run or tested pubsub against a server that old.

Smack has testcases which do that exact scenario (publish and then retrieve) to test the getItems() method, and I don’t think I have ever seen that.

Can you verify that your node is configured properly? You might also want to check OF-16 that was fixed several versions ago.

My mistake, the server is 3.8.2! I was thinking of the smack version, which was 3.3.0.

We’ll experiment with this a little more on our side and see if it continues happening. We seemed to have some race conditions on the Android side which were just causing weird behavior in general.