浏览代码

HADOOP-19305: Fix ProcessEnvironment ClassCastException in Shell.java (#7106) Contributed by Butao Zhang.

Signed-off-by: Shilun Fan <slfan1989@apache.org>
Butao Zhang 3 月之前
父节点
当前提交
1bd4835a3d
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java

+ 3 - 1
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java

@@ -977,7 +977,9 @@ public abstract class Shell {
       builder.environment().clear();
     }
 
-    builder.environment().putAll(this.environment);
+    if (!environment.isEmpty()) {
+      builder.environment().putAll(this.environment);
+    }
 
     if (dir != null) {
       builder.directory(this.dir);