1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Fix SASLAuthentication.getRegisteredSASLMechanisms

by using a LinkedHashMap which is insertion-ordered as compared to
HashMap.
This commit is contained in:
Florian Schmaus 2017-03-18 12:59:52 +01:00
parent 3640339073
commit dcac9531e7

View file

@ -34,9 +34,9 @@ import javax.security.auth.callback.CallbackHandler;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -90,7 +90,7 @@ public final class SASLAuthentication {
* @return the registered SASLMechanism sorted by the level of preference. * @return the registered SASLMechanism sorted by the level of preference.
*/ */
public static Map<String, String> getRegisterdSASLMechanisms() { public static Map<String, String> getRegisterdSASLMechanisms() {
Map<String, String> answer = new HashMap<String, String>(); Map<String, String> answer = new LinkedHashMap<String, String>();
synchronized (REGISTERED_MECHANISMS) { synchronized (REGISTERED_MECHANISMS) {
for (SASLMechanism mechanism : REGISTERED_MECHANISMS) { for (SASLMechanism mechanism : REGISTERED_MECHANISMS) {
answer.put(mechanism.getClass().getName(), mechanism.getName()); answer.put(mechanism.getClass().getName(), mechanism.getName());