diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index a990a4bce41..a34f3f4e28b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -1552,7 +1552,8 @@ public class HMaster extends HRegionServer implements MasterServices { * @return Client info for use as prefix on an audit log string; who did an action */ public String getClientIdAuditPrefix() { - return "Client=" + RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress(); + return "Client=" + RpcServer.getRequestUserName().orElse(null) + + "/" + RpcServer.getRemoteAddress().orElse(null); } /** diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java index bff69ba0b7b..0623b2c3346 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java @@ -1137,7 +1137,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler, if (LOG.isWarnEnabled()) { LOG.warn("Large batch operation detected (greater than " + rowSizeWarnThreshold + ") (HBASE-18023)." + " Requested Number of Rows: " + sum + " Client: " - + RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress() + + RpcServer.getRequestUserName().orElse(null) + "/" + + RpcServer.getRemoteAddress().orElse(null) + " first region in multi=" + firstRegionName); } } @@ -1727,8 +1728,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler, @QosPriority(priority=HConstants.ADMIN_QOS) public ClearCompactionQueuesResponse clearCompactionQueues(RpcController controller, ClearCompactionQueuesRequest request) throws ServiceException { - LOG.debug("Client=" + RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress() - + " clear compactions queue"); + LOG.debug("Client=" + RpcServer.getRequestUserName().orElse(null) + "/" + + RpcServer.getRemoteAddress().orElse(null) + " clear compactions queue"); ClearCompactionQueuesResponse.Builder respBuilder = ClearCompactionQueuesResponse.newBuilder(); requestCount.increment(); if (clearCompactionQueues.compareAndSet(false,true)) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java index e849b30fa40..f116b3074bd 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java @@ -374,7 +374,7 @@ public class TestTokenAuthentication { public AuthenticationProtos.GetAuthenticationTokenResponse getAuthenticationToken( RpcController controller, AuthenticationProtos.GetAuthenticationTokenRequest request) throws ServiceException { - LOG.debug("Authentication token request from " + RpcServer.getRequestUserName()); + LOG.debug("Authentication token request from " + RpcServer.getRequestUserName().orElse(null)); // Ignore above passed in controller -- it is always null ServerRpcController serverController = new ServerRpcController(); final NonShadedBlockingRpcCallback @@ -392,7 +392,7 @@ public class TestTokenAuthentication { public AuthenticationProtos.WhoAmIResponse whoAmI( RpcController controller, AuthenticationProtos.WhoAmIRequest request) throws ServiceException { - LOG.debug("whoAmI() request from " + RpcServer.getRequestUserName()); + LOG.debug("whoAmI() request from " + RpcServer.getRequestUserName().orElse(null)); // Ignore above passed in controller -- it is always null ServerRpcController serverController = new ServerRpcController(); NonShadedBlockingRpcCallback callback =