ZanderXu commented on code in PR #4821:
URL: https://github.com/apache/hadoop/pull/4821#discussion_r957930476


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java:
##########
@@ -1439,7 +1440,7 @@ private void checkSuperuserPrivilege() throws 
IOException, AccessControlExceptio
       return;
     }
     // Try to get the ugi in the RPC call.
-    UserGroupInformation callerUgi = ipcServer.getRemoteUser();
+    UserGroupInformation callerUgi = Server.getRemoteUser();

Review Comment:
   @tomscut Sir, thanks for you review. The change here is just formatting 
code, not for possible NPE. Because getRemoteUser() is a static method, should 
access it via the Server reference. And there is already a judgment of NPE here.
   ```
   // Try to get the ugi in the RPC call.
       UserGroupInformation callerUgi = ipcServer.getRemoteUser();
       if (callerUgi == null) {
         // This is not from RPC.
         callerUgi = UserGroupInformation.getCurrentUser();
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to