1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-23 02:58:00 +01:00

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
This commit is contained in:
rcollier 2013-10-07 01:38:09 +00:00
parent 25012a6744
commit 3146023dd4
2 changed files with 9 additions and 4 deletions

View file

@ -61,6 +61,7 @@ public class ItemProvider implements PacketExtensionProvider
if (tag == XmlPullParser.END_TAG && parser.getName().equals(elem)) if (tag == XmlPullParser.END_TAG && parser.getName().equals(elem))
{ {
done = true; done = true;
continue;
} }
else if (parser.getEventType() == XmlPullParser.START_TAG) else if (parser.getEventType() == XmlPullParser.START_TAG)
{ {
@ -87,10 +88,14 @@ public class ItemProvider implements PacketExtensionProvider
else if (parser.getEventType() == XmlPullParser.END_TAG) else if (parser.getEventType() == XmlPullParser.END_TAG)
{ {
if (isEmptyElement) if (isEmptyElement)
{
isEmptyElement = false; isEmptyElement = false;
}
else else
{
payloadText.append("</").append(parser.getName()).append(">"); payloadText.append("</").append(parser.getName()).append(">");
} }
}
else if (parser.getEventType() == XmlPullParser.TEXT) else if (parser.getEventType() == XmlPullParser.TEXT)
{ {
payloadText.append(parser.getText()); payloadText.append(parser.getText());
@ -99,9 +104,9 @@ public class ItemProvider implements PacketExtensionProvider
} }
return new PayloadItem<SimplePayload>(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText.toString())); return new PayloadItem<SimplePayload>(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText.toString()));
} }
else { else
return new PayloadItem<PacketExtension>(id, node, PacketParserUtils.parsePacketExtension( {
payloadElemName, payloadNS, parser)); return new PayloadItem<PacketExtension>(id, node, PacketParserUtils.parsePacketExtension(payloadElemName, payloadNS, parser));
} }
} }
} }

View file

@ -17,7 +17,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.jivesoftware.smack.packet.PacketExtension; import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smackx.provider.EmbeddedExtensionProvider; import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
import org.jivesoftware.smackx.pubsub.ItemsExtension; import org.jivesoftware.smackx.pubsub.ItemsExtension;
/** /**