HADOOP-16707. NPE in UGI.getCurrentUser in ITestAbfsIdentityTransformer setup.
Contributed by Steve Loughran. Change-Id: I38fdba2fa70e534d78b15e61de19368912588b0c
This commit is contained in:
parent
dfc61d8ea5
commit
1415ad3800
@ -584,6 +584,7 @@ public boolean hasKerberosCredentials() {
|
|||||||
@InterfaceAudience.Public
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public static UserGroupInformation getCurrentUser() throws IOException {
|
public static UserGroupInformation getCurrentUser() throws IOException {
|
||||||
|
ensureInitialized();
|
||||||
AccessControlContext context = AccessController.getContext();
|
AccessControlContext context = AccessController.getContext();
|
||||||
Subject subject = Subject.getSubject(context);
|
Subject subject = Subject.getSubject(context);
|
||||||
if (subject == null || subject.getPrincipals(User.class).isEmpty()) {
|
if (subject == null || subject.getPrincipals(User.class).isEmpty()) {
|
||||||
@ -670,6 +671,7 @@ public static UserGroupInformation getUGIFromSubject(Subject subject)
|
|||||||
@InterfaceAudience.Public
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public static UserGroupInformation getLoginUser() throws IOException {
|
public static UserGroupInformation getLoginUser() throws IOException {
|
||||||
|
ensureInitialized();
|
||||||
UserGroupInformation loginUser = loginUserRef.get();
|
UserGroupInformation loginUser = loginUserRef.get();
|
||||||
// a potential race condition exists only for the initial creation of
|
// a potential race condition exists only for the initial creation of
|
||||||
// the login user. there's no need to penalize all subsequent calls
|
// the login user. there's no need to penalize all subsequent calls
|
||||||
|
Loading…
Reference in New Issue
Block a user