Skip the proxy user check if the ugi has not been initialized. Contributed by Daryn Sharp

This commit is contained in:
Rushabh Shah 2018-05-21 12:33:00 -05:00
parent f48fec83d0
commit 73e9120ad7
2 changed files with 7 additions and 3 deletions

View File

@ -281,7 +281,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
} }
private static boolean getRestrictParserDefault(Object resource) { private static boolean getRestrictParserDefault(Object resource) {
if (resource instanceof String) { if (resource instanceof String || !UserGroupInformation.isInitialized()) {
return false; return false;
} }
UserGroupInformation user; UserGroupInformation user;

View File

@ -288,14 +288,18 @@ public class UserGroupInformation {
public static final String HADOOP_TOKEN_FILE_LOCATION = public static final String HADOOP_TOKEN_FILE_LOCATION =
"HADOOP_TOKEN_FILE_LOCATION"; "HADOOP_TOKEN_FILE_LOCATION";
public static boolean isInitialized() {
return conf != null;
}
/** /**
* A method to initialize the fields that depend on a configuration. * A method to initialize the fields that depend on a configuration.
* Must be called before useKerberos or groups is used. * Must be called before useKerberos or groups is used.
*/ */
private static void ensureInitialized() { private static void ensureInitialized() {
if (conf == null) { if (!isInitialized()) {
synchronized(UserGroupInformation.class) { synchronized(UserGroupInformation.class) {
if (conf == null) { // someone might have beat us if (!isInitialized()) { // someone might have beat us
initialize(new Configuration(), false); initialize(new Configuration(), false);
} }
} }