1717 */
1818package org .apache .hadoop .security ;
1919
20- import org .apache .hadoop .HadoopIllegalArgumentException ;
2120import org .apache .hadoop .classification .InterfaceAudience ;
2221import org .apache .hadoop .classification .InterfaceStability ;
2322import org .apache .hadoop .conf .Configuration ;
@@ -49,14 +48,7 @@ private static synchronized String getSynchronously() {
4948 HADOOP_SECURITY_SASL_MECHANISM_DEFAULT );
5049 LOG .debug ("{} = {} (conf)" , HADOOP_SECURITY_SASL_MECHANISM_KEY , confValue );
5150
52- if (envValue != null && confValue != null ) {
53- if (!envValue .equals (confValue )) {
54- throw new HadoopIllegalArgumentException ("SASL Mechanism mismatched: env "
55- + SASL_MECHANISM_ENV + " is " + envValue + " but conf "
56- + HADOOP_SECURITY_SASL_MECHANISM_KEY + " is " + confValue );
57- }
58- }
59-
51+ // env has a higher precedence than conf
6052 mechanism = envValue != null ? envValue
6153 : confValue != null ? confValue
6254 : HADOOP_SECURITY_SASL_MECHANISM_DEFAULT ;
@@ -69,8 +61,8 @@ public static String getMechanism() {
6961 return value != null ? value : getSynchronously ();
7062 }
7163
72- public static boolean isDefaultMechanism (String mechanism ) {
73- return HADOOP_SECURITY_SASL_MECHANISM_DEFAULT .equals (mechanism );
64+ public static boolean isDefaultMechanism (String saslMechanism ) {
65+ return HADOOP_SECURITY_SASL_MECHANISM_DEFAULT .equals (saslMechanism );
7466 }
7567
7668 private SaslMechanismFactory () {}
0 commit comments