From 3146023dd48227231a5fd1caa9d0a49f96338ee7 Mon Sep 17 00:00:00 2001 From: rcollier Date: Mon, 7 Oct 2013 01:38:09 +0000 Subject: [PATCH] SMACK-455 Fixed improper advance of parser when parsing multiple items in a pubsub message. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_1@13760 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/pubsub/provider/ItemProvider.java | 11 ++++++++--- .../smackx/pubsub/provider/ItemsProvider.java | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java b/source/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java index 7b06af301..ff151ed34 100644 --- a/source/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java +++ b/source/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java @@ -61,6 +61,7 @@ public class ItemProvider implements PacketExtensionProvider if (tag == XmlPullParser.END_TAG && parser.getName().equals(elem)) { done = true; + continue; } else if (parser.getEventType() == XmlPullParser.START_TAG) { @@ -87,9 +88,13 @@ public class ItemProvider implements PacketExtensionProvider else if (parser.getEventType() == XmlPullParser.END_TAG) { if (isEmptyElement) + { isEmptyElement = false; + } else + { payloadText.append(""); + } } else if (parser.getEventType() == XmlPullParser.TEXT) { @@ -99,9 +104,9 @@ public class ItemProvider implements PacketExtensionProvider } return new PayloadItem(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText.toString())); } - else { - return new PayloadItem(id, node, PacketParserUtils.parsePacketExtension( - payloadElemName, payloadNS, parser)); + else + { + return new PayloadItem(id, node, PacketParserUtils.parsePacketExtension(payloadElemName, payloadNS, parser)); } } } diff --git a/source/org/jivesoftware/smackx/pubsub/provider/ItemsProvider.java b/source/org/jivesoftware/smackx/pubsub/provider/ItemsProvider.java index 01cb9d4b2..6f66b6de0 100644 --- a/source/org/jivesoftware/smackx/pubsub/provider/ItemsProvider.java +++ b/source/org/jivesoftware/smackx/pubsub/provider/ItemsProvider.java @@ -17,7 +17,7 @@ import java.util.List; import java.util.Map; import org.jivesoftware.smack.packet.PacketExtension; -import org.jivesoftware.smackx.provider.EmbeddedExtensionProvider; +import org.jivesoftware.smack.provider.EmbeddedExtensionProvider; import org.jivesoftware.smackx.pubsub.ItemsExtension; /**