HDFS-7026. Introduce a string constant for "Failed to obtain user group info...". Contributed by Yongjun Zhang.
This commit is contained in:
parent
e532ed8faa
commit
cbd21fd13b
|
@ -57,6 +57,8 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
public class SecurityUtil {
|
||||
public static final Log LOG = LogFactory.getLog(SecurityUtil.class);
|
||||
public static final String HOSTNAME_PATTERN = "_HOST";
|
||||
public static final String FAILED_TO_GET_UGI_MSG_HEADER =
|
||||
"Failed to obtain user group information:";
|
||||
|
||||
// controls whether buildTokenService will use an ip or host/ip as given
|
||||
// by the user
|
||||
|
|
|
@ -376,6 +376,9 @@ Release 2.7.0 - UNRELEASED
|
|||
HDFS-7202. Should be able to omit package name of SpanReceiver on "hadoop
|
||||
trace -add" (iwasakims via cmccabe)
|
||||
|
||||
HDFS-7026. Introduce a string constant for "Failed to obtain user group
|
||||
info...". (Yongjun Zhang via atm)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -354,7 +354,8 @@ public class WebHdfsFileSystem extends FileSystem
|
|||
// extract UGI-related exceptions and unwrap InvalidToken
|
||||
// the NN mangles these exceptions but the DN does not and may need
|
||||
// to re-fetch a token if either report the token is expired
|
||||
if (re.getMessage().startsWith("Failed to obtain user group information:")) {
|
||||
if (re.getMessage().startsWith(
|
||||
SecurityUtil.FAILED_TO_GET_UGI_MSG_HEADER)) {
|
||||
String[] parts = re.getMessage().split(":\\s+", 3);
|
||||
re = new RemoteException(parts[1], parts[2]);
|
||||
re = ((RemoteException)re).unwrapRemoteException(InvalidToken.class);
|
||||
|
|
|
@ -27,6 +27,7 @@ import javax.ws.rs.ext.Provider;
|
|||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hdfs.server.common.JspHelper;
|
||||
import org.apache.hadoop.security.SecurityUtil;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod;
|
||||
|
||||
|
@ -54,7 +55,7 @@ public class UserProvider
|
|||
AuthenticationMethod.KERBEROS, false);
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException(
|
||||
"Failed to obtain user group information: " + e, e);
|
||||
SecurityUtil.FAILED_TO_GET_UGI_MSG_HEADER + " " + e, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ public class TestDelegationTokensWithHA {
|
|||
// Mimic the UserProvider class logic (server side) by throwing
|
||||
// SecurityException here
|
||||
throw new SecurityException(
|
||||
"Failed to obtain user group information: " + e, e);
|
||||
SecurityUtil.FAILED_TO_GET_UGI_MSG_HEADER + " " + e, e);
|
||||
}
|
||||
} catch (Exception oe) {
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue