From 3640339073dbc9400288d682a9d65cef53ab1375 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 15 Mar 2017 21:25:37 +0100 Subject: [PATCH] Fix ConnectionConfiguration.getEnabledSaslMechanisms() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in case enabledSaslMechanisms is null, because then unmodifiableSet() will throw an NPE. Thanks to Nándor Holozsnyák for reporting. --- .../org/jivesoftware/smack/ConnectionConfiguration.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java index a5b12da29..55f76798a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java @@ -472,7 +472,16 @@ public abstract class ConnectionConfiguration { return enabledSaslMechanisms.contains(saslMechanism); } + /** + * Return the explicitly enabled SASL mechanisms. May return null if no SASL mechanisms where + * explicitly enabled, i.e. all SALS mechanisms supported and announced by the service will be considered. + * + * @return the enabled SASL mechanisms or null. + */ public Set getEnabledSaslMechanisms() { + if (enabledSaslMechanisms == null) { + return null; + } return Collections.unmodifiableSet(enabledSaslMechanisms); }