YARN-3005. [JDK7] Use switch statement for String instead of if-else statement in RegistrySecurity.java (Contributed by Kengo Seki)
This commit is contained in:
parent
db51548f70
commit
533e551eb4
@ -80,6 +80,9 @@ Release 2.7.0 - UNRELEASED
|
|||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
|
||||||
|
YARN-3005. [JDK7] Use switch statement for String instead of if-else
|
||||||
|
statement in RegistrySecurity.java (Kengo Seki via aajisaka)
|
||||||
|
|
||||||
YARN-2950. Change message to mandate, not suggest JS requirement on UI.
|
YARN-2950. Change message to mandate, not suggest JS requirement on UI.
|
||||||
(Dustin Cote via harsh)
|
(Dustin Cote via harsh)
|
||||||
|
|
||||||
|
@ -192,14 +192,17 @@ protected void serviceInit(Configuration conf) throws Exception {
|
|||||||
String auth = conf.getTrimmed(KEY_REGISTRY_CLIENT_AUTH,
|
String auth = conf.getTrimmed(KEY_REGISTRY_CLIENT_AUTH,
|
||||||
REGISTRY_CLIENT_AUTH_ANONYMOUS);
|
REGISTRY_CLIENT_AUTH_ANONYMOUS);
|
||||||
|
|
||||||
// TODO JDK7 SWITCH
|
switch (auth) {
|
||||||
if (REGISTRY_CLIENT_AUTH_KERBEROS.equals(auth)) {
|
case REGISTRY_CLIENT_AUTH_KERBEROS:
|
||||||
access = AccessPolicy.sasl;
|
access = AccessPolicy.sasl;
|
||||||
} else if (REGISTRY_CLIENT_AUTH_DIGEST.equals(auth)) {
|
break;
|
||||||
|
case REGISTRY_CLIENT_AUTH_DIGEST:
|
||||||
access = AccessPolicy.digest;
|
access = AccessPolicy.digest;
|
||||||
} else if (REGISTRY_CLIENT_AUTH_ANONYMOUS.equals(auth)) {
|
break;
|
||||||
|
case REGISTRY_CLIENT_AUTH_ANONYMOUS:
|
||||||
access = AccessPolicy.anon;
|
access = AccessPolicy.anon;
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
throw new ServiceStateException(E_UNKNOWN_AUTHENTICATION_MECHANISM
|
throw new ServiceStateException(E_UNKNOWN_AUTHENTICATION_MECHANISM
|
||||||
+ "\"" + auth + "\"");
|
+ "\"" + auth + "\"");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user