|
@@ -420,7 +420,7 @@ public final class SecurityUtil {
|
|
*/
|
|
*/
|
|
public static void setTokenService(Token<?> token, InetSocketAddress addr) {
|
|
public static void setTokenService(Token<?> token, InetSocketAddress addr) {
|
|
Text service = buildTokenService(addr);
|
|
Text service = buildTokenService(addr);
|
|
- if (token != null) {
|
|
|
|
|
|
+ if (token != null && service != null) {
|
|
token.setService(service);
|
|
token.setService(service);
|
|
if (LOG.isDebugEnabled()) {
|
|
if (LOG.isDebugEnabled()) {
|
|
LOG.debug("Acquired token "+token); // Token#toString() prints service
|
|
LOG.debug("Acquired token "+token); // Token#toString() prints service
|
|
@@ -440,9 +440,10 @@ public final class SecurityUtil {
|
|
String host = null;
|
|
String host = null;
|
|
if (useIpForTokenService) {
|
|
if (useIpForTokenService) {
|
|
if (addr.isUnresolved()) { // host has no ip address
|
|
if (addr.isUnresolved()) { // host has no ip address
|
|
- throw new IllegalArgumentException(
|
|
|
|
- new UnknownHostException(addr.getHostName())
|
|
|
|
- );
|
|
|
|
|
|
+ LOG.warn("unable to resolve host name " + addr
|
|
|
|
+ + ". Failure to construct a correct token service "
|
|
|
|
+ + "name may result in operation failures");
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
host = addr.getAddress().getHostAddress();
|
|
host = addr.getAddress().getHostAddress();
|
|
} else {
|
|
} else {
|