From 14d232c0fe3cfd85476bb6b0f1558ebc062a1891 Mon Sep 17 00:00:00 2001 From: Anu Engineer Date: Thu, 3 Jan 2019 09:43:26 -0800 Subject: [PATCH] HDDS-957. Replace incorrect use of system property user.name. Contributed by Dinesh Chitlangia. --- .../hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java | 2 +- .../hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java index bee6c49e564..6feaeee20ab 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/CreateVolumeHandler.java @@ -79,7 +79,7 @@ public class CreateVolumeHandler extends Handler { if (root) { rootName = "hdfs"; } else { - rootName = System.getProperty("user.name"); + rootName = UserGroupInformation.getCurrentUser().getShortUserName(); } VolumeArgs.Builder volumeArgsBuilder = VolumeArgs.newBuilder() diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java index 1b7f2a36514..265ae2508ed 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/volume/ListVolumeHandler.java @@ -31,6 +31,7 @@ import org.apache.hadoop.ozone.web.ozShell.OzoneAddress; import org.apache.hadoop.ozone.web.ozShell.Shell; import org.apache.hadoop.ozone.web.utils.JsonUtils; +import org.apache.hadoop.security.UserGroupInformation; import picocli.CommandLine.Command; import picocli.CommandLine.Option; import picocli.CommandLine.Parameters; @@ -76,7 +77,7 @@ public class ListVolumeHandler extends Handler { OzoneClient client = address.createClient(createOzoneConfiguration()); if (userName == null) { - userName = System.getProperty("user.name"); + userName = UserGroupInformation.getCurrentUser().getShortUserName(); } if (maxVolumes < 1) {