From 10643cce7ca37040f2080e2f0b5df71ebdb17b48 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 5 Nov 2014 17:58:32 +0100 Subject: [PATCH] Use LinkedHashMap for PacketExtensions in Packet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to keep the order in which the elements are added. Some XEPs define a Schema using 'xs:sequence' (see for example XEP-60 ยง 17.1), so the order the PacketExtensions are added should be the same they are transformed to a XML String. --- .../src/main/java/org/jivesoftware/smack/packet/Packet.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java index bd658c039..1529404b8 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java @@ -25,7 +25,7 @@ import org.jxmpp.util.XmppStringUtils; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; @@ -62,7 +62,7 @@ public abstract class Packet extends TopLevelStreamElement { */ private static final AtomicLong id = new AtomicLong(); - private final Map packetExtensions = new HashMap(12); + private final Map packetExtensions = new LinkedHashMap(12); private String packetID = null; private String to = null;