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
1 changed files with 2 additions and 2 deletions

View File

@ -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<String, String> getRegisterdSASLMechanisms() {
Map<String, String> answer = new HashMap<String, String>();
Map<String, String> answer = new LinkedHashMap<String, String>();
synchronized (REGISTERED_MECHANISMS) {
for (SASLMechanism mechanism : REGISTERED_MECHANISMS) {
answer.put(mechanism.getClass().getName(), mechanism.getName());