Fix ConnectionConfiguration.getEnabledSaslMechanisms()

in case enabledSaslMechanisms is null, because then unmodifiableSet()
will throw an NPE.

Thanks to Nándor Holozsnyák for reporting.
This commit is contained in:
Florian Schmaus 2017-03-15 21:25:37 +01:00
parent 0a6843f41f
commit 3640339073
1 changed files with 9 additions and 0 deletions

View File

@ -472,7 +472,16 @@ public abstract class ConnectionConfiguration {
return enabledSaslMechanisms.contains(saslMechanism);
}
/**
* Return the explicitly enabled SASL mechanisms. May return <code>null</code> 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 <code>null</code>.
*/
public Set<String> getEnabledSaslMechanisms() {
if (enabledSaslMechanisms == null) {
return null;
}
return Collections.unmodifiableSet(enabledSaslMechanisms);
}