Merged r1206427 from branch-0.20-security for HADOOP-7854.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-205@1206428 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 560b734..11ea131 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -134,6 +134,8 @@
 
     HDFS-2590. Fix the missing links in the WebHDFS forrest doc.  (szetszwo)
 
+    HDFS-7854. UGI getCurrentUser is not synchronized. (Daryn Sharp via jitendra)
+
 Release 0.20.205.0 - 2011.10.06
 
   NEW FEATURES
diff --git a/src/core/org/apache/hadoop/security/UserGroupInformation.java b/src/core/org/apache/hadoop/security/UserGroupInformation.java
index a3464f5..f9aed0d 100644
--- a/src/core/org/apache/hadoop/security/UserGroupInformation.java
+++ b/src/core/org/apache/hadoop/security/UserGroupInformation.java
@@ -407,7 +407,8 @@
    * @return the current user
    * @throws IOException if login fails
    */
-  public static UserGroupInformation getCurrentUser() throws IOException {
+  public synchronized
+  static UserGroupInformation getCurrentUser() throws IOException {
     AccessControlContext context = AccessController.getContext();
     Subject subject = Subject.getSubject(context);
     return subject == null ? getLoginUser() : new UserGroupInformation(subject);