From dcac9531e772a87b8e30549d03571ce5a334c67b Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 18 Mar 2017 12:59:52 +0100 Subject: [PATCH] Fix SASLAuthentication.getRegisteredSASLMechanisms by using a LinkedHashMap which is insertion-ordered as compared to HashMap. --- .../main/java/org/jivesoftware/smack/SASLAuthentication.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java index 5cc8f5dcd..ff22d3790 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java @@ -34,9 +34,9 @@ import javax.security.auth.callback.CallbackHandler; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -90,7 +90,7 @@ public final class SASLAuthentication { * @return the registered SASLMechanism sorted by the level of preference. */ public static Map getRegisterdSASLMechanisms() { - Map answer = new HashMap(); + Map answer = new LinkedHashMap(); synchronized (REGISTERED_MECHANISMS) { for (SASLMechanism mechanism : REGISTERED_MECHANISMS) { answer.put(mechanism.getClass().getName(), mechanism.getName());